[gdal-dev] Unable to obtain EPSG from OGRSpatialReference
Nik
nik at nixanz.com
Wed Jun 7 00:15:10 PDT 2017
It seems like you may be trying to get the EPSG code for the projected SRS but you are using a call that retrieves the geographic SRS. If this is the case then you might want to try using both of:
OGRSpatialReference::GetAuthorityName
OGRSpatialReference::GetAuthorityCode
These are not guaranteed to produce results, but if the information is available, the first is likely to return "EPSG" and the second would then return the numeric EPSG code.
-----------------------------------------
NIK SANDS
Line Tamer | Time Traveller | Space Cadet
> On 7 Jun 2017, at 3:30 pm, Andre Joost <andre+joost at nurfuerspam.de> wrote:
>
>> 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
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170607/32813e95/attachment.html>
More information about the gdal-dev
mailing list