[gdal-dev] Achieving Better WKT -> EPSG Code Autodetection When Importing Layers to Postgis

Andrew Joseph ap.joseph at live.com
Fri Sep 22 19:36:46 PDT 2017


I am having issues with OGR being unable to autodetect the correct EPSG code
for arbitrary .prj files. I haven't dealt with any data I'd consider to have
an "exotic" projection -usually just your typical state plane coordinate
systems that are typically used for most publicly available GIS datasets in
the US. 

For example:

PROJCS["NAD_1983_StatePlane_Texas_Central_FIPS_4203_Feet",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["False_Easting",2296583.333333333],PARAMETER["False_Northing",9842500.0],PARAMETER["Central_Meridian",-100.3333333333333],PARAMETER["Standard_Parallel_1",30.11666666666667],PARAMETER["Standard_Parallel_2",31.88333333333333],PARAMETER["Latitude_Of_Origin",29.66666666666667],UNIT["Foot_US",0.3048006096012192]]


When dealing with Postgis -this is a HUGE problem. If an invalid or
nonexistent EPSG code is provided by OGR, your table is basically unusable
until/unless you either write a script utilizing other software such as
geotools OR lookup your SRIDs manually by copying the .prj file contents
into prj2epsg. While writing an external script is not a massive undertaking
by any means -it would be helpful if external tools/additional processes
could be avoided (in common cases) to get the correct EPSG code for a given
layer. 

The EPSG detection issue also renders it difficult to use tools like the
awesome ogr_fdw (https://github.com/pramsey/pgsql-ogr-fdw), particularly
with IMPORT FOREIGN SCHEMA (see
https://github.com/pramsey/pgsql-ogr-fdw/issues/131) on shapefiles.

Perhaps a JNI bridge could be used,like with the MDB driver, given that the
Geotools projection library (gt-referencing) seems to work with the
projections I have tested -and is also what backs prj2epsg which is what is
typically used as a manual last resort when all else fails. 

I've had this issue for years, but concede I might be missing something. Is
there anything that can remedy this issue utilizing existing functionality?





--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html


More information about the gdal-dev mailing list