Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpatialReference::identifyVerticalEPSG() does not work #3943

Open
wonder-sk opened this issue Jan 18, 2023 · 1 comment
Open

SpatialReference::identifyVerticalEPSG() does not work #3943

wonder-sk opened this issue Jan 18, 2023 · 1 comment

Comments

@wonder-sk
Copy link
Contributor

When a SpatialReference is constructed with a valid compound CRS, identifyVerticalEPSG() returns no EPSG code even if it is explicitly stated in the VERT_CS bit. For example, for this WKT it should return "6647" but it returns empty string:

"COMPD_CS[\"NAD83(CSRS) / UTM zone 17N + CGVD2013\",PROJCS[\"NAD83(CSRS) / UTM zone 17N\",GEOGCS[\"NAD83(CSRS)\",DATUM[\"NAD83_Canadian_Spatial_Reference_System\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6140\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4617\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",-81],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"2958\"]],VERT_CS[\"CGVD2013\",VERT_DATUM[\"Canadian Geodetic Vertical Datum of 2013\",2005,AUTHORITY[\"EPSG\",\"1127\"]],UNIT[\"metre\",1.0,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Gravity-related height\",UP],AUTHORITY[\"EPSG\",\"6647\"]]]"

It looks like the issue is that OGRSpatialReference::AutoIdentifyEPSG() returns OGRERR_UNSUPPORTED_SRS for all vertical CRS but PDAL requires OGRERR_NONE to be returned, and won't try to return the EPSG code from the definition.

It would make sense to either skip the AutoIdentifyEPSG call for vertical CRS, or to first try to get the EPSG code from WKT, and then try auto-identify only when it is not present in WKT.

It seems this function is not used by PDAL itself though...

GDAL code: https://github.com/OSGeo/gdal/blob/a632e3093d6dd34cdcf979a5b2a20529fe2df943/ogr/ogr_fromepsg.cpp#L305

@hobu
Copy link
Member

hobu commented Feb 6, 2023

It would make sense to either skip the AutoIdentifyEPSG call for vertical CRS, or to first try to get the EPSG code from WKT, and then try auto-identify only when it is not present in WKT.

Please make this PR if you want it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants