Skip to content

Instantly share code, notes, and snippets.

@esutton
Last active January 11, 2023 16:48
Show Gist options
  • Save esutton/2a4c0aa26bf8fd57916fb3603cce47c8 to your computer and use it in GitHub Desktop.
Save esutton/2a4c0aa26bf8fd57916fb3603cce47c8 to your computer and use it in GitHub Desktop.
NAD83 to WGS84 - Python
# https://gis.stackexchange.com/questions/304231/converting-nad83-epsg4269-to-wgs84-epsg4326-using-pyproj
# Output:
# (-80.00001, 40.00001)
# (-80.00001904501643, 40.00003299028925)
# (-80.00001618601023, 40.00001788467985)
#
# projections, datums, transformations, coordinates
from pyproj import Proj, transform
p2 = Proj(init='epsg:4326')
# no offsets
p1 = Proj(init='epsg:4269')
# method: coordinate frame
p1cf = Proj(proj='latlong', ellps='GRS80', datum='NAD83', towgs84='-0.9956,1.9013,0.5215,-0.025915,-0.009426,-0.0011599,-0.00062')
# method: position vector
p1pv = Proj(proj='latlong', ellps='GRS80', datum='NAD83', towgs84='-0.9956,1.9013,0.5215,0.025915,0.009426,0.0011599,-0.00062')
print(transform(p1, p2 , -80.00001, 40.00001))
print(transform(p1cf, p2 , -80.00001, 40.00001))
print(transform(p1pv, p2 , -80.00001, 40.00001))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment