[gdal-dev] How do I tell if an OGRSpatialReference has been initialized?

Even Rouault even.rouault at mines-paris.org
Wed Jul 24 06:51:12 PDT 2013


Le mercredi 24 juillet 2013 15:43:11, David Strip a écrit :
> I had considered validate(), but decided against it for the reason you
> suggest - an initialized SRS might be in some weird format that fails
> validation. I've been using exportToWkt(), but was/am concerned that it
> might be possible to fail to export in odd-ball situations. Hence, my
> question about a direct check. Sounds like exportToWkt() is my best bet.

exportToWkt() cannot fail (except out-of-memory problem). (Valid) WKT 
representation and OSR model are completely bijective.

Another way of testing is OGRSpatialReference has been initialized is to test 
if poSRS->GetRoot() != NULL. (only available in the C++ API)

Even

-- 
Geospatial professional services
http://even.rouault.free.fr/services.html


More information about the gdal-dev mailing list