You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was somewhat surprised to find that I was getting different coordinates back when transforming from WGS84 to NAD83 StatePlane Missouri Central (i.e. EPSG:102697), than what I was seeing in QGIS and my customers GIS.
The long and the short of it is that the EPSG:102697 uses +units=us-ft, however proj4 appears to ignore this and all projected coordinates appear to be given in meter-units. I'm not sure if this is expected behavior, and why it differs to that exhibited by GDAL?
Following is an IPython notebook than demonstrates the issue:
importpyprojfromosgeoimportosr
# Given a particular coordinate in Springfield, Missouri## -93.28, 37.2LONGITUDE=-93.28LATITUDE=37.2# and taking a "sensible" projected coordinate system for that region: EPSG:102697PROJ4_INIT="+proj=tmerc +lat_0=35.83333333333334 +lon_0=-92.5 +k=0.999933333 +x_0=500000 +y_0=0 +datum=NAD83 +units=us-ft +no_defs"# .. Note the use of +units=us-ft in the above
# In Proj4p1=pyproj.Proj("+init=epsg:4326")
p2=pyproj.Proj(PROJ4_INIT)
print("PyPROJ: {}, {} -> {}".format(LONGITUDE, LATITUDE, pyproj.transform(p1, p2, LONGITUDE, LATITUDE)))
x, y=pyproj.transform(p1, p2, LONGITUDE, LATITUDE)
print("Converting to us-ft: {}, {}".format(meters_to_feet(x), meters_to_feet(y)))
print("Backwards: {}, {} -> {}".format(x, y, pyproj.transform(p2, p1, x, y)))
# Observe: The result appears to come back in meters (not us-ft), and a transform from # projected coordinates -> geographic expects units in meters also.
# In GDALp1=osr.SpatialReference()
p1.ImportFromEPSG(4326)
p2=osr.SpatialReference()
p2.ImportFromProj4(PROJ4_INIT)
project=osr.CoordinateTransformation(p1, p2)
reverse=osr.CoordinateTransformation(p2, p1)
print("GDAL: {}, {} -> {}".format(LONGITUDE, LATITUDE, project.TransformPoint(LONGITUDE, LATITUDE)))
x, y, _=project.TransformPoint(LONGITUDE, LATITUDE)
print("Already appears in us-ft: {}, {}".format(x, y))
print("Backwards: {}, {} -> {}".format(x, y, reverse.TransformPoint(x, y)))
# Observe: The result appears to come back in us-ft, as expected, and a transform from# projected coordinates -> geographic expects units in us-ft also.
# If we then revise the PROJ4_INIT string and re-run the GDAL test, we see the same (meter) units as per Proj.4PROJ4_INIT="+proj=tmerc +lat_0=35.83333333333334 +lon_0=-92.5 +k=0.999933333 +x_0=500000 +y_0=0 +datum=NAD83 +no_defs"p1=osr.SpatialReference()
p1.ImportFromEPSG(4326)
p2=osr.SpatialReference()
p2.ImportFromProj4(PROJ4_INIT)
project=osr.CoordinateTransformation(p1, p2)
reverse=osr.CoordinateTransformation(p2, p1)
print("GDAL: {}, {} -> {}".format(LONGITUDE, LATITUDE, project.TransformPoint(LONGITUDE, LATITUDE)))
x, y, _=project.TransformPoint(LONGITUDE, LATITUDE)
print("Converting to us-ft: {}, {}".format(meters_to_feet(x), meters_to_feet(y)))
print("Backwards: {}, {} -> {}".format(x, y, reverse.TransformPoint(x, y)))
This looks like an issue with pyproj at first sight, since GDAL uses the proj C API and doesn't do itself the units to foot conversion but delegates that to proj. You'd bette reporting to https://github.com/jswhit/pyproj . Closing under the assumption that's a pyproj issue. Please reopen if you don't think it is (and have more elements to "prove" it)
Hi,
I was somewhat surprised to find that I was getting different coordinates back when transforming from WGS84 to NAD83 StatePlane Missouri Central (i.e. EPSG:102697), than what I was seeing in QGIS and my customers GIS.
The long and the short of it is that the EPSG:102697 uses +units=us-ft, however proj4 appears to ignore this and all projected coordinates appear to be given in meter-units. I'm not sure if this is expected behavior, and why it differs to that exhibited by GDAL?
Following is an IPython notebook than demonstrates the issue:
The text was updated successfully, but these errors were encountered: