1

Using PROJ, this command will convert / reproject / transform a WGS84 latlon point to NAD27 CONUS, UTM zone 11:

cs2cs.exe +proj=latlong +init=EPSG:4326 +to +init=EPSG:26711
-120 39
240281.39       4320858.54 0.00

We'd like to use a pure-python solution instead. pygeodesy utm.toUtm8 returns the UTM coordinates of a given latlon point:

>>> utm.toUtm8(39,-120)
[Z:11S, H:N, E:240200, N:4321059]

You can specify datum as an argument to toUtm8, but that datum applies to both the input latlon and the output UTM values, i.e. it does not do a datum conversion - it would have to assume the datum of the latlon point in order to do a conversion anyway:

>>> utm.toUtm8(39,-120,datum=Datums.NAD27)
[Z:11S, H:N, E:240193, N:4320851]
>>> utm.toUtm8(39,-120,datum=Datums.WGS84) 
[Z:11S, H:N, E:240200, N:4321059]
>>> utm.toUtm8(39.00011,-119.99900,datum=Datums.NAD27) 
[Z:11S, H:N, E:240280, N:4320861]

How does one do the datum conversion / reprojection / transformation from WGS84 to NAD27 in pygeodesy? A two-step process would be fine:

  1. convert WGS84 latlon to NAD27 latlon, then
  2. convert NAD27 latlon to NAD27 UTM with .toUtm8 as above
4
  • 1
    Are you familiar with pyproj: github.com/pyproj4/pyproj
    – snowman2
    Commented Sep 18, 2022 at 3:44
  • Yes, thanks we've been using pyproj for a while. But, it's not a pure-python solution. It's a wrapper around proj, and the proj executables must be installed separately, so the external dependency is what we're getting rid of.
    – Tom Grundy
    Commented Sep 18, 2022 at 12:29
  • pyproj provides python wheels, so you shouldn't need to install PROJ separately unless you have a platform that doesn't have a wheel.
    – snowman2
    Commented Sep 18, 2022 at 13:04
  • Hmm, must be that we're not understanding the install procedure; pip install pyproj on a windows box resulted in 'Getting requirements to build wheel did not run successfully' due to what might be a failure to have the right grid shift files or such. Regardless, rather than chase that down, we're pretty far along with the migration to pygeodesy.
    – Tom Grundy
    Commented Sep 18, 2022 at 17:26

1 Answer 1

1

Found the solution by going to the 'Index' link in pygeodesy docs, then going to 'R' looking for 'reproject' (nothing there) then going to 'C' looking for 'convert' which found the deprecated convertDatum functions.

from pygeodesy import Datums,ellipsoidalBase
ellipsoidalBase.LatLonEllipsoidalBase(39,-120,datum=Datums.WGS84).toDatum(Datums.NAD27).toUtm()
[Z:11S, H:N, E:240280, N:4320859]

The docs are pretty thorough! It's in there somewhere! Interesting that googling didn't turn it up.

You can then call .toStr with various arguments to get various string output formats.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.