0
votes

I have coordinate data consisting of two 6-digit numbers (e.g., 300,000 250,000) that I want to convert into long., lat. coordinates. I'm told that the coordinate data (referred to as GLNX, GLNY) come from the Michigan State Plane coordinate system, EPSG number ESRI:102121 However, when I pass that 102121 number to gdal.ImportFromEPSG, it complains that it knows it not. Two questions:

  1. How do I create a SpatialReference for ESRI:102121
  2. Can I pass my 6-digit number pair directly to reProject, or do I need to "adjust" it, e.g., scale by some power of 10, or convert from feet to meters, or what?
1
GDAL reference for importFromEPSG -- "The coordinate system definitions are normally read from the EPSG derived support files ... and falling back to search for a PROJ.4 epsg init file or a definition in epsg.wkt." Check that the 102121 projection is in those support files.Erica

1 Answers

0
votes

I'm not sure how you are using the GDAL API, but with GDAL 2.0 through Python, this works for me:

from osgeo import osr
osr.UseExceptions()
sr = osr.SpatialReference()
sr.ImportFromEPSG(102121)  # returns 0 for success, which I get

But I suspect this does not work, as described in your question. So you can import from the PROJ.4 code instead, which you can get from http://epsg.io/102121 or add a .proj4 extension to the raw code:

import urllib2
srid = 102121
response = urllib2.urlopen('http://epsg.io/%d.proj4' % (srid,))
sr.ImportFromProj4(response.read())  # returns 0 for success
print(sr.ExportToPrettyWkt())  # shows that it is understood

The PROJ.4 code is ultimately used by libproj to do the actual projection, not the WKT.