Building Compound CRS with WGS84 & EGM96?
See original GitHub issueDisclaimer: I have read https://pyproj4.github.io/pyproj/stable/gotchas.html#axis-order-changes-in-proj-6 and am aware of the fact that PROJ now honors the axis order of a CRS when initialized with EPSG:xxxx
.
Code Sample
I think I have found an inconsistency in the way the axis order is interpreted with EPSG:4326
.
Consider the following snippet:
import pyproj
ellipsoid = pyproj.CRS.from_epsg(4326) # WGS84
geoid = pyproj.CRS.from_epsg(5773) # EGM96
utm = pyproj.CRS.from_epsg(32610) # UTM zone 10
lat, lon = 45, -122
for name, trf in zip(
["WGS84 -> EGM96", "WGS84 -> UTM"],
[pyproj.Transformer.from_crs(ellipsoid, geoid), pyproj.Transformer.from_crs(ellipsoid, utm)],
):
print(name, "lon, lat", trf.transform(lon, lat, 10))
print(name, "lat, lon", trf.transform(lat, lon, 10))
It prints the following output:
WGS84 -> EGM96 lon, lat (-122.0, 45.0, 30.38683319091797)
WGS84 -> EGM96 lat, lon (45.0, -122.0, -inf)
WGS84 -> UTM lon, lat (inf, inf, inf)
WGS84 -> UTM lat, lon (578815.302916712, 4983436.768349296, 10.0)
Problem description
Since the axis order of EPSG:4326
is
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude (degree)
- Lon[east]: Geodetic longitude (degree)
I would expect to always have to pass x=lat, y=lon
in a Transformer.transform
call in order for everything to work correctly.
However as shown with the snippet above:
- when transforming datums from WGS84 to EGM96, it is the call with
x=lon, y=lat
that gives the correct output - when transforming coordinates from WGS84 to UTM zone 10, as expected it is the call with
x=lat, y=lon
that gives the correct output.
Expected Output
I would expect to always have to pass x=lat, y=lon
in Transformer.transform
when my crs_from
is EPSG:4326
, irrespective of what my crs_to
is.
Environment Information
2.6.1.post1
Installation method
pip wheel
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Getting Started - pyproj 3.4.1 documentation - GitHub Pages
Using CRS# · Find UTM CRS by Latitude and Longitude# · Transformations from CRS to CRS# · Converting between geographic and projection coordinates...
Read more >python 3.x - Convertion between compound CRS with pyproj
I came across this example online, and it does work for me. import pyproj cmpd_crs = pyproj.crs.CompoundCRS(name="WGS 84 + EGM96 height", ...
Read more >Vertical Datum transformation using Pyproj
My logic was to take a WGS84 coordinate with an ellipsoid elevation and try to convert that into NAD83 NADV88 (epsg:5498). But it...
Read more >Compound coordinate systems for "World" - EPSG.io
WGS 84 + EGM96 height. EPSG:9707. Area of use: World Transform coordinates | Get position on a map · Search deprecated (1).
Read more >Functions — PROJ 9.1.1 documentation
a compound CRS made from two object names separated with “ + “. e.g. “WGS 84 + EGM96 height” (added in 7.1). Example...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Side note, here is the shorthand version for the compound CRS:
It does some auto-conversions behind the scenes. But, with limited information it may or may not produce what you want. Probably where the axis-order inconsistencies come into play.
Probably due to my environment missing the needed grid.