<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>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:</div><div id="AppleMailSignature"><br></div><div id="AppleMailSignature"><span style="font-weight: bold; background-color: rgba(255, 255, 255, 0);">OGRSpatialReference::GetAuthorityName</span></div><div id="AppleMailSignature"><b><br></b></div><div id="AppleMailSignature"><span style="font-weight: bold; background-color: rgba(255, 255, 255, 0);">OGRSpatialReference::GetAuthorityCode</span><b><br></b><br>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. <br><br>-----------------------------------------<div><div>NIK SANDS</div><div>Line Tamer | Time Traveller | Space Cadet</div></div></div><div><br>On 7 Jun 2017, at 3:30 pm, Andre Joost <<a href="mailto:andre+joost@nurfuerspam.de">andre+joost@nurfuerspam.de</a>> wrote:<br><br></div><blockquote type="cite"><div><span>Am 07.06.2017 um 02:35 schrieb Mike K:</span><br><blockquote type="cite"><span>Hello,</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>I have a situation in which I would like to load up a set of polygons, and</span><br></blockquote><blockquote type="cite"><span>determine what EPSG code they are using. I am testing with a simple square</span><br></blockquote><blockquote type="cite"><span>polygon in upstate New York using the UTM projection, saved into a Shapefile</span><br></blockquote><blockquote type="cite"><span>.</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>I am able to create my dataset, layer, and read the geometry just fine. I</span><br></blockquote><blockquote type="cite"><span>can get access to the spatial reference, but if I call the</span><br></blockquote><blockquote type="cite"><span>OGRSpatialReference::GetEPSGGeogCS() function, it always returns code 4326 (</span><br></blockquote><blockquote type="cite"><span>which is lat/lon ). This is not correct, but if I query other values, they</span><br></blockquote><blockquote type="cite"><span>seem to be valid. For instance, OGRSpatialReference::GetUTMZone() will</span><br></blockquote><blockquote type="cite"><span>return 17 N, which is correct.</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Does anybody know why I might be getting the wrong EPSG code? I had thought</span><br></blockquote><blockquote type="cite"><span>I might just have bad data, but the fact that I can get the values</span><br></blockquote><blockquote type="cite"><span>individually makes me think it is something about how I am using the</span><br></blockquote><blockquote type="cite"><span>functions. Thank you for any advice.</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><span></span><br><span>What EPSG code do you think is "right" ?</span><br><span></span><br><span>Many projected coordinate systems are based on a geographical coordinate system more or less identical to WGS84 (EPSG:4326).</span><br><span></span><br><span>HTH,</span><br><span>André Joost</span><br><span></span><br><span></span><br><span>_______________________________________________</span><br><span>gdal-dev mailing list</span><br><span><a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a></span><br><span><a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a></span></div></blockquote></body></html>