When I'm using PostGIS for transforming coordinates from WGS 84 (EPSG 4326) to Web Mercator (EPSG 3857) the result for POINT(-180 0) is POINT(-20037508.3427892 -7.08115455161362e-010) and for POINT(180 0) it is POINT(20037508.3427892 -7.08115455161362e-010).

As I understood the Web Mercator projection there is a square that displays a stretched sphere. So when converting from 4326 to 3857 the WGS globe coordinates will be transformed to square raster coordinates. There is a specific formula for that, but the absolute result depends on the given width (height) of the raster square.

At PostGIS it seems there is a width of 40075016.6855784 assumed. Is that just a magic number defined by PostGIS developers or is it a kind of standard value? Is there a standard for -180 => -width / 2 and +180 => +width / 2 or would -180 => 0 and +180 => width also be "OK"? I mean at the end it's just a translation, isn't it?


1 Answer 1


EPSG:4326 also known as the World Geodetic Datum or wgs84 is based on a ellipsoid whose major axis is 6378137m. That means if you cut the wgs84 based earth at the equator you will get a circle of radius 6378137m. When that circle is transferred to square coordinates. The perimeter of the circle becomes the X-axis, 40075016.6855784 is the perimeter of the circle whose radius is 6378137m. But this value is only true on the equator, at other places we have to follow the process of transformation, a simple translation is not enough.

  • OK, it's the circumference of earth in meters. I was all the time thinking in pixels or other computing units, but clear..just meters. Thanks for the hint!
    – Maas
    May 22, 2018 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.