[gdal-dev] EPSG codes

Even Rouault even.rouault at spatialys.com
Wed Dec 10 02:05:37 PST 2014


Le mercredi 10 décembre 2014 03:38:45, Norman Barker a écrit :
> Hi,
> 
> I am trying to extract the EPSG code from the SpatialReference object as
> follow;
> 
>             const char * pszEpsg;
>             char **papszTokens;
> 
>             if (poSpatialRef->IsProjected())
>                 pszEpsg =
> poSpatialRef->GetAttrNode("projcs")->GetNode("authority")->GetValue();
>             else
>                 pszEpsg =
> poSpatialRef->GetAttrNode("geogcs")->GetNode("authority")->GetValue();
> 
> It seems that GetAttrNode returns NULL even ogrinfo -so reports that this
> is present.
> 
> Any ideas?

Norman,

Use GetAuthorityCode(NULL) :
http://gdal.org/classOGRSpatialReference.html#a178f4593ef4ee661f2df9d221feaa803

Even

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


More information about the gdal-dev mailing list