[gdal-dev] Confusing error behavior of OGR_L_GetSpatialRef

Even Rouault even.rouault at spatialys.com
Tue Nov 13 13:55:05 PST 2018


On mardi 13 novembre 2018 14:13:27 CET Sean Gillies wrote:
> Hi,
> 
> While debugging a problem with my Fiona project I realized that if
> GDAL_DATA is not known, OGR_L_GetSpatialRef() (master branch and also
> 2.3.2) can return a not-NULL spatial reference while also putting a
> CE_Failure error on the error stack.

This is driver specific behaviour. How can we reproduce ?
Is the SRS returned still meaningful or somewhat dummy ?

> Is this intended or is the error code
> perhaps one level too high in this case? Are application using GDAL
> supposed to continue working if the EPSG support files aren't found? Might
> this be changed to a warning instead?

Well GDAL_DATA not defined or not set correctly is something supposed not to 
happen in correctly setup environment.

Returning an error or a warning depends on the context (if importing a EPSG 
code as a user requested action and no GDAL_DATA, then it is an error. But if 
it is some attempt of a driver to identify a SRS against a well-known CRS in 
the database, then it would be more a warning), but at the point where the 
error is detected, this is too level for the code to known.

Anyway soon that will be PROJ_LIB that you will have to define correctly ;-)


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list