[OSM-dev] Projection Issues

Christopher Schmidt crschmidt at crschmidt.net
Wed May 31 18:21:08 BST 2006


On Wed, May 31, 2006 at 08:16:44AM -0700, Mikel Maron wrote:
> Do you have an OpenLayers instance configured to request tiles from OSM in Mercator? With that, I can look at any problems
> in streets.rbx. For the extent of the world, you can set the northern and southern borders to anything reasonable, say 85/-85.
> 
> Does that sound like a good next step?

Right now, the WMS powering OSM does not support the Mercator projection
(at least, not if 
http://svn.openstreetmap.org/www.openstreetmap.org/ruby/api/wms/wms.map
is accurate). All layers are are WGS-84 (straight lat/lon projection), 
so there is no way to request mercator projected images.

It does seem like OSM is using a tile engine which stretches tiles such
that they follow the mercator projection -- images near the poles are
stretched to infinity, certainly -- but I'm afraid that doesn't mean
much for OpenLayers.

Somewhere, there's a disconnect between what the streets code is doing,
and what the OSM WMS server thinks its doing. 

So heres the way OpenLayers works:

 It gets a size of the world, and from there, it splits the world up
 into tilesized chunks. These tiles can be any size -- the default is
 256 by 256. A 'maxresolution' is determined: this is the number of
 degrees per pixel at zoom level 0. (It appears that Tile.js is using
 the same as Google Maps, 1.40625 degrees/pixel.)

 From there, it essentially creates a worldwide grid, starting in the
 top left and going around the world. These tiles are all the same in
 degrees -- there is no 'bending' of the world at the poles.

As I understand it, a mercator projection can be implemented in a system
such as this: The backend WMS server is the one bending the images to
fit the tiles -- the tiles should not be bending to fit the earth. In
the OSM setup, the tile requests themselves are modified as you get away
from the equator -- which is not a system I've seen any other WMS client
mimic.

As I understand it, 'Mercator Projection', at least insofar as
mapserver understands it, also means "units in meters", not "units in
degrees". So even if there was a way to flip the switch to set the WMS
to Mercator, this would not work right for OSM...

At this point, I'm largely just confused, and I'm willing to
admit that I think with the current setup, OSM and OpenLayers simply
aren't going to work together. I don't claim to understand projections
well enough to know what's going on, and without knowing that, I can't
begin to create a tile system that will grab tiles in the same format as
OSM currently is.

-- 
Christopher Schmidt
Web Developer




More information about the dev mailing list