[postgis-users] Strange EPSG:3857 transformation results.

Wolfgang Glas wolfgang.glas at iteg.at
Sat Jun 18 12:44:10 PDT 2016


Hi all,

  I desperately tried to recalculate WGS84/EPSG:3857 (pseudo-mercator)
transformations and have really weird results using postgis 2.2.2 with
postgres 9.5.3

First example is the origin 0/0 of WGS84:

#  select ST_AsText(ST_Transform(
    ST_GeomFromText('POINT(0.0 0.0)',4236),3857));
                  st_astext                  
--------------------------------------------
  POINT(-549.033225716555 -204.380569358876)
 (1 row)

To my understanding the origin of EPSG 3857 is also the origin of EPSG
4326/WGS84, so the result seem to be plain wrong to me :-/

Another unit test was:

# cs2cs +init=epsg:3857 +to +init=epsg:4326 -f %.17lg
 1400000 6000000
 12.576413977673299 47.353704702433106 0

For this test, postgis gave different values as in:

# select ST_AsText(ST_Transform(
   ST_GeomFromText('POINT(1400000 6000000)',3857),4236));
                 st_astext                  
------------------------------------------
  POINT(12.5816693645354 47.3508570080732)

According to my research, the results of cs2cs are exact and e.g. in
line with http://wiki.openstreetmap.org/wiki/Mercator

My postgres/postgis versions are:

PostgreSQL 9.5.3 on x86_64-pc-linux-gnu, compiled by gcc (Debian
4.9.2-10) 4.9.2, 64-bit POSTGIS="2.2.2 r14797" GEOS="3.4.2-CAPI-1.8.2
r3921" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.10.1, released
2013/08/26" LIBXML="2.9.1" LIBJSON="0.11.99" RASTER

  Dose anybody have experience with mercator transformations and "false"
offsets like in my origin example,

   TIA, Wolfgang


More information about the postgis-users mailing list