[OSM-talk] OSM et al map projections

Christopher Schmidt crschmidt at metacarta.com
Sun Jan 21 12:12:12 GMT 2007


On Sun, Jan 21, 2007 at 05:57:20PM +0800, Mike Collinson wrote:
> tiles at home, JOSM's "Mercator" projection and Google Earth uses what 
> I've seen termed as "Simple Mercator".  This assumes the earth is 
> perfectly round when projecting onto a flat surface, i.e. it does not 
> take into account the WGS 84 spheroid.

That is not the standard definition of 'Simple Mercator' in the
geospatial world -- Simple Mercator in GIS means "WGS84 ellipsoid", so
far as I can tell. (At least, that's how everyone uses it.) For most WMS
interactions with Google, this works fine, but only because they depend
on Google to provide the translation from screen pixels to mercator
coordinates. I don't have that benefit. 

> Slippy map:  I've no real idea what the difference between the mapnik 
> db, mapnik, mapnik WMS-C and osmarender base layers are.  I'd assume 
> Osmarender is coming from osm at home and therefore using a flat earth 
> projection for each tile.  If mapnik base layers are coming from the 
> mapnik library itself 
> (http://svn.berlios.de/svnroot/repos/mapnik/trunk) my guess from 
> source code inspection that it is also using a flat-earth projection.

The mapnik configuration file for OSM says:

<Map bgcolor="#f2efe9" srs="+proj=merc +datum=WGS84  +k=1.0 +units=m
+no_defs">

So does the Mapnik configuration for the WMS-C layer.

The difference between them is that the generate_Tile code that sits
between the tile indices and the map generation does a reprojection
step, which I don't have the ability to reproduce in TileCache since 
there is no such step in TileCache.    

> Mapnik
> 
> I couldn't track down what is happening, the code is not exactly 
> written for linear traceibility.  The key files seem to be the 
> following, if so I'd stab a guess that it is using an "earth is flat" 
> direct-from-lat/lon projection but using the major axis of the WGS 84 
> spheroid for degrees to metres conversion.

It actually uses the Proj cartographic library, hence the pj_transform
in the following source file, which is outside your purview.

> http://svn.berlios.de/svnroot/repos/mapnik/trunk/src/proj_transform.cpp
> http://svn.berlios.de/svnroot/repos/mapnik/trunk/src/projection.cpp
> http://svn.berlios.de/svnroot/repos/mapnik/trunk/src/scale_denominator.cpp :
> 
> Google Earth
> 
> http://cfis.savagexi.com/articles/2006/05/03/google-maps-deconstructed
> 
> Uses the "Simple Mercator" projection, i.e. assumes the earth is round.

Again, "Simple mercator" and "earth is round" are distinct. 

> Yahoo aerial photo imagery

All the major commercial APIs use the exact same projection: if the
problem is solved for one of them, it's solved for all of them.

Regards,
-- 
Christopher Schmidt
MetaCarta




More information about the talk mailing list