Created
August 20, 2022 19:25
-
-
Save bertt/eb27c404149e3a5ecb9fe6499d52f99a to your computer and use it in GitHub Desktop.
ecef2latlon using pyproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyproj | |
lon = 1231256.4091099831 | |
lat = -4800453.896456448 | |
alt = 4000024.663498499 | |
transformer = pyproj.Transformer.from_crs("EPSG:4978", "EPSG:4326") | |
print(transformer) | |
xyz = transformer.transform(lon, lat, alt) | |
print('Projected XY', xyz) | |
lonlat = transformer.transform(xyz[0], xyz[1], xyz[2], direction='INVERSE') | |
print('Lon Lat', lonlat) | |
Result: | |
proj=pipeline step inv proj=cart ellps=WGS84 step proj=unitconvert xy_in=rad xy_out=deg step proj=axisswap order=2,1 | |
Projected XY (39.096413909747135, -75.61445288733434, -959.1868305588141) | |
Lon Lat (1231256.4091099836, -4800453.896456448, 4000024.663498508) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment