[gdal-dev] Unable to obtain EPSG from OGRSpatialReference

Andre Joost andre+joost at nurfuerspam.de
Tue Jun 6 22:30:53 PDT 2017


Am 07.06.2017 um 02:35 schrieb Mike K:
> Hello,
>
> I have a situation in which I would like to load up a set of polygons, and
> determine what EPSG code they are using.  I am testing with a simple square
> polygon in upstate New York using the UTM projection, saved into a Shapefile
> .
>
> I am able to create my dataset, layer, and read the geometry just fine.  I
> can get access to the spatial reference, but if I call the
> OGRSpatialReference::GetEPSGGeogCS() function, it always returns code 4326 (
> which is lat/lon ).  This is not correct, but if I query other values, they
> seem to be valid.  For instance, OGRSpatialReference::GetUTMZone() will
> return 17 N, which is correct.
>
> Does anybody know why I might be getting the wrong EPSG code?  I had thought
> I might just have bad data, but the fact that I can get the values
> individually makes me think it is something about how I am using the
> functions.  Thank you for any advice.
>

What EPSG code do you think is "right" ?

Many projected coordinate systems are based on a geographical coordinate 
system more or less identical to WGS84 (EPSG:4326).

HTH,
André Joost




More information about the gdal-dev mailing list