I want to convert x/y/z-ECEF positions to lla (lat/lon/alt) using WGS84 in python with pyproj but it seems like the conversion fails.
Example code is here:
import pyproj
# Example position data, should be somewhere in Germany
x = 652954.1006
y = 4774619.7919
z = -2217647.7937
ecef = pyproj.Proj(proj='geocent', ellps='WGS84', datum='WGS84')
lla = pyproj.Proj(proj='latlong', ellps='WGS84', datum='WGS84')
lon, lat, alt = pyproj.transform(ecef, lla, x, y, z, radians=True)
print lat, lon, alt
Can someone see where the problem is?
EDIT: By now I guess the calculations are correct, just the data I get from my receiver seems to be faulty. Can someone confirm that?
Latest pyproj version style
import pyproj
transformer = pyproj.Transformer.from_crs(
{"proj":'geocent', "ellps":'WGS84', "datum":'WGS84'},
{"proj":'latlong', "ellps":'WGS84', "datum":'WGS84'},
)
x = 652954.1006
y = 4774619.7919
z = -2217647.7937
lon1, lat1, alt1 = transformer.transform(x,y,z,radians=False)
print (lat1, lon1, alt1 )
You got -24.887220848803032 82.2128095673836 -1069542.1692923503
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With