-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vertical datum transformation based on PROJ #761
Comments
If you are referring to the code with GDAL in it, then no. I am strongly opposed to adding GDAL as a dependency to pyproj due to the complexity it adds. However, I do like the concept of a centralizing the code somewhere for that. Maybe creating another package specifically for that purpose (pyproj-grids?). Potentially useful libraries to include in that package could include rioxarray and pyresample. Another alternative would be to raise an issue upstream (https://github.com/osgeo/proj) to see if they would expose an API for reading grids through PROJ. If they do that, I would be more supportive of adding the logic directly to pyproj. |
Hopefully your question has been answered (I am assuming that is the case). |
Yes, thanks a lot! :) |
@rhugonnet how did you implement the vertical transformation? Doing something like this obviously deosen't make sense: Did you need to write your own vertical transformation: https://gis.stackexchange.com/questions/352277/including-geoidgrids-when-initializing-projection-via-epsg/352300#352300?? |
This should do it: transformer=Transformer.from_crs(
"epsg:4326",
CRS(init="epsg:26934", geoidgrids=r'C:\Users\Eyal\Downloads\geoid09_ak.gtx')
)
transformer.transform(lat_d,lon_d,abs_alt) |
thanks @snowman2 , this worked well. But I get the note that init is deprecated. So I tried without init c:\users\eyal\appdata\local\programs\python\python37\lib\site-packages\pyproj\crs\crs.py in init(self, projparams, **kwargs) pyproj_crs.pyx in pyproj._crs._CRS.init() CRSError: Invalid projection: epsg:26934 +geoidgrids=C:\Users\Eyal\Downloads\geoid09_ak.gtx +type=crs: (Internal Proj Error: proj_create: unrecognized format / unknown name)` |
|
That's a lot of snowmans in the same conversation! ⛄ @snowman907 I kept the crs_init = pyproj.CRS(4326)
# to remove warning
with warnings.catch_warnings():
warnings.filterwarnings("ignore", module="pyproj")
# your grid file is available here: https://github.com/OSGeo/PROJ-data/tree/master/us_noaa, filename works
# only if your pyproj.datadir is defined properly (good chance it's OK by default) and if you have proj-data
crs_dest = pyproj.Proj(init="EPSG:26934", geoidgrids='us_noaa_geoid09_ak.tif').crs
transform = Transformer.from_crs(crs_init,crs_dest) Along with a team of colleagues, we're in the process of writing a DEM package to put together (robustly and consistently, if possible) all the DEM tools we've been developing for the past ~10 years. It's early stages still, but here's the code for vertical grid shifting within a DEM class: https://github.com/GlacioHack/xdem/blob/main/xdem/dem.py#L116 |
Thanks, @rhugonnet for your insight and @snowman2 for your hard work developing pyproj and responding patiently to a large number of issues with the same question. Yay for snowmans lol |
Hi all,
I've been trying to apply vertical transformation of data using pyproj. For example, converting heights from the WGS84 ellipsoid to the EGM96 geoid.
Using the EGM .gtx files of PROJ here, I get a good result using the old pyproj.Proj method with init and geoidgrids keyword argument (example inspired by https://gis.stackexchange.com/questions/340392/vertical-datum-transformation-using-pyproj):
for which I get:
I looked for another way to do this with current Pyproj methods but couldn't find anything or any issue referenced on this.
I'm thus wondering:
Thanks a lot in advance!
The text was updated successfully, but these errors were encountered: