More

Why prj2epsg cannot resolve PostGIS SRText?

Why prj2epsg cannot resolve PostGIS SRText?


In many places I have seen people referring to http://prj2epsg.org (here, here). I have used this service too, however, the service cannot uniquely identify an EPSG code alway. I understand that it might not always be possible to determine the EPSG code, but what about common ones? For example, the link bellow uses the service to determine EPSG code for the SRText for EPSG:3857 found from PostGIS'sspatial_ref_systable:

http://prj2epsg.org/search.json?terms=PROJ…

Am I using the service Incorrectly? Or PostGIS stores SRText differently than prj2epsg expects?

In case you are interested, here is the actual SRText:

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"]],UNIT["metre",1,AUTHORITY["EPSG","9001"]],PROJECTION["Mercator_1SP"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],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 [email protected] +wktext +no_defs"],AUTHORITY["EPSG","3857"],AXIS["X",EAST],AXIS["Y",NORTH]]

If you compare your input and what the service sends back for EPSG:3857 you can indeed see many differences, for example:

DATUM["World Geodetic System 1984", DATUM["WGS_1984" PROJECTION["Popular Visualisation Pseudo Mercator", AUTHORITY["EPSG","1024"]] PROJECTION["Mercator_1SP"]

So you were right with your guess "Or PostGIS stores SRText differently than prj2epsg expects?"

You can find many more variants for the EPSG:3857 from this GDAL ticket http://trac.osgeo.org/gdal/ticket/3962. You can also read this part of source code as an example about how much work must be done for trying to make non-identical WKT definitions to fit http://trac.osgeo.org/gdal/browser/trunk/gdal/ogr/ogr_srs_esri_names.h. GeoTools which is used in the service that you used must face similar problems than GDAL.


Watch the video: DB creation PostGIS in cloud for QGIS in 10 minutes DigitalOcean + Postgres