[gdal-dev] Differences between OSRImportFromEPSG and OSRImportFromProj4

Sean Gillies sean at mapbox.com
Wed Feb 6 14:58:01 PST 2019


Hi all,

I observe a difference between the WKT exports of OSRImportFromEPSG(osr,
3857) and OSRImportFromProj4(osr, "+init=epsg:3857"). The former gives a
named coordinate system, the latter gives an unnamed coordinate system.

Case 1:

OSRImportFromEPSG(osr, 3857)
OSRExportToWkt(osr)

'PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["WGS
84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Mercator_1SP"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",EAST],AXIS["Y",NORTH],EXTENSION["PROJ4","+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 +wktext +no_defs"],AUTHORITY["EPSG","3857"]]'

Case 2:

OSRImportFromProj4(osr, "+init=epsg:3857")
OSRExportToWkt(osr)

'PROJCS["unnamed",GEOGCS["unnamed
ellipse",DATUM["unknown",SPHEROID["unnamed",6378137,0],EXTENSION["PROJ4_GRIDS","@null"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]],PROJECTION["Mercator_2SP"],PARAMETER["standard_parallel_1",0],PARAMETER["central_meridian",0],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["Meter",1],AUTHORITY["EPSG","3857"]]'

Am I wrong to understand the semantics of "+init=epsg:3857" as "open the
epsg database, get entry 3857, and use that"? Is this different from
specifying the entry directly?

Thanks in advance,

-- 
Sean Gillies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20190206/db8386df/attachment.html>


More information about the gdal-dev mailing list