I am trying to convert between EPSG 4326 and 4978. I have wrote the following codes:
import pyproj lon = -74.6604194 lat = 40.3450248 transformer = pyproj.Transformer.from_crs("EPSG:4326", "EPSG:4978", always_xy = True) print(transformer) xy = transformer.transform(lon, lat) print('Projected XY', xy) lonlat = transformer.transform(xy, xy, direction='INVERSE') print('Lon Lat', lonlat)
This is the result it produces. As you can see it converts the lon/lat to the right xy. However, when I try to convert xy back to lon/lat, I always get a 0.0 lat value. I have tried with other xy values and I always get a 0.0 lat. What seems to be wrong with my code?
proj=pipeline step proj=unitconvert xy_in=deg xy_out=rad step proj=cart ellps=WGS84 Projected XY (1287775.7028415564, -4694570.895022585) Lon Lat (-74.6604194, 0.0)