[OSM-dev] Mapnik / General question on projection

Andy Allan gravitystorm at gmail.com
Thu Nov 18 18:59:54 GMT 2010

On Thu, Nov 18, 2010 at 5:58 PM, M∡rtin Koppenhoefer
<dieterdreist at gmail.com> wrote:
> First I must admit that I don't know much about projections, reference
> systems and geodetic datums.
> I have recently experimented with homemade hillshading and contours,
> and I found out by trying that my hillshade was fitting the contours
> if I assumed it was in EPSG 3785 (I created the hillshading from SRTM
> with Grass GIS and reprojected to an EPSG 900913 setting while the
> contours were created with mapnik and srtm2osm).
> By reading the EPSG documentation sheets it seems that 3785 and 3857
> are not the same (the first uses a sphere, while the latter uses an
> ellipsoid with inverse flattening of 298.257223563). EPSG says that
> the ellipsoid-version is valid (and registered as 3857) while the
> sphere is not. This results visually in quite some change on the map
> if you mix it up.
> Therefor I thought that Mapnik's 900913 was equal to EPSG's
> "non-valid" 3785 version with the sphere. (EPSG states: "Sphere with
> radius equal to the semi-major axxis of the GRS80 and WGS84
> ellipsoids. Used only for Web approximate mapping and visualisation.
> Not recognised by geodetic authorities" --- on which I found some
> comments ("EPSG is arrogant") in the web btw. who said it was
> perfectly working with the sphere as well, even if not scientifically
> correct).
> Now I found some docs in the OSM-Wiki that state we were using EPSG 3857.
> My own tests indicate "we" are using the (not registered) "3785" (sphere).
> Also this setting in mapnik/inc/entities.xml.inc indicates this:
> <!ENTITY srs900913 "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0
> +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs
> +over">
> in generate_image.py I found this (seems that someone changed from
> sphere to ellipsoid):
>    # prj = mapnik.Projection("+proj=merc +a=6378137 +b=6378137
> +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null
> +no_defs +over")
>    prj = mapnik.Projection("+proj=merc +a=6378137 +rf=298.257223563
> +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null
> +no_defs +over")
> can someone please tell me which datum is used by the mapnik and T at H
> tile servers?

I'm totally confused by your email, so bear with me.

As far as I'm aware, 900913, 3785 and 3857 are all identical, and
don't have the difference that you are describing above. From


http://spatialreference.org/ref/sr-org/6864/ (EPSG:3857)

>From the proj4 project:

Moreover, you refer to changes made to the generate_image.py file, but
I don't see such a change:

However, the following two entries at EPSG are conflicting with all
the above, and do in fact appear to be different:

Ho hum. Maybe take it up with the proj project? Anyway, we use
Spherical Mercator ie. the one without the +rf=298.25... so I'd find a
different copy of generate_image.py


More information about the dev mailing list