It's my recollection from a question I posted here  a little over a year
ago that except for a few special cases, autoIdentifyEPSG only works if
there is an authority node providing the EPSG. Hopefully someone will
give you an authoritative answer. I believe GeoTools has the capability
to find the EPSG from the WKT, but I have no idea how to interface to that

On 8/28/2014 8:42 PM, Nik Sands wrote:
> Hi devs,
>
> What is the correct way to extract the EPSG code from an OGRSpatialReferenceH 
> ?
>
> Currently I'm finding that the following works only for SRS of some images 
> and not others:
>
>       const char *charAuthType = OSRGetAttrValue(gdal.srcSRS, "AUTHORITY", 0);
>       const char *charSrsCode = OSRGetAttrValue(gdal.srcSRS, "AUTHORITY", 1);
>
> However, there is no "AUTHORITY" node in some SRSs so it doesn't work for 
> those images.  To cater for this, I'm trying to explicitly set the authority 
> node using:
>
>       OSRAutoIdentifyEPSG(gdal.srcSRS);
>
> But this fails with OGRERR_UNSUPPORTED_SRS (even when it is an SRS that GDAL 
> recognises and uses well).
>
> So I'm stumped... how do I reliably determine the EPSG for an 
> OGRSpatialReferenceH?
>
> Cheers,
> Nik.
>
> _______________________________________________
> gdal-dev mailing list
> [email protected]
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>

_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to