pyproj4 / pyproj

Python interface to PROJ (cartographic projections and coordinate transformations library)
https://pyproj4.github.io/pyproj
MIT License
1.07k stars 215 forks source link

WGS84 to DHDN #1032

Closed grigoroffbenj closed 2 years ago

grigoroffbenj commented 2 years ago

Problem description

Hi, if I use our tools to convert WGS84 / LL ellipsoid height to DHDN / GK4 ellipsoid height, the conversion working great with "de_adv_BETA2007.tif" but de Z is not converted and still on GRS80 ellipsoid... I have converted my CRS to ".to_3d()" but it's not working.

How can I convert the Z in bessel ellipsoid ?

Thanks in advance for your help.

Exemple

import pyproj

#define CRS
crsIn = pyproj.CRS.from_epsg(4326).to_3d().to_wkt()
crsOut = pyproj.CRS.from_epsg(31468).to_3d().to_wkt()

# greate TransformerGroup to see if grids are present
group = pyproj.transformer.TransformerGroup(crsIn, crsOut, always_xy=True)
group.best_available
>>>True
group.unavailable_operations
>>>[]

#check pipeline with de_adv_BETA2007.tif
group.transformers[0].to_proj4()
>>>+proj=pipeline +step +proj=unitconvert +xy_in=deg +z_in=m +xy_out=rad +z_out=m +step +inv +proj=hgridshift +grids=de_adv_BETA2007.tif +step +proj=tmerc +lat_0=0 +lon_0=12 +k=1 +x_0=4500000 +y_0=0 +ellps=bessel

#transform coord
group.transformers[0].transform(10.5352150500, 51.1901083600, 288.8800000000)
>>> 4397703.681687116, 5673812.4399475735, 288.88

#Check with other method
transformer_3d = pyproj.Transformer.from_crs(crsIn, crsOut, always_xy=True)
transformer_3d.transform(10.53521505, 51.19010836, 288.88)
>>> 4397703.6817 5673812.4399 288.88

Environment Information

pyproj info:
    pyproj: 3.3.0
      PROJ: 8.2.1
  data dir: C:\Users\***\.conda\envs\MSAPI\Library\share\proj
user_data_dir: C:\Users\***\AppData\Local/proj
PROJ DATA (recommended version): 1.8
PROJ Database: 1.2
EPSG Database: v10.041 [2021-12-03]
ESRI Database: ArcMap 12.8 [2021-05-06]
IGNF Database: 3.1.0 [2019-05-24]

System:
    python: 3.8.0 | packaged by conda-forge | (default, Nov 22 2019, 19:04:36) [MSC v.1916 64 bit (AMD64)]
executable: C:\Users\***\.conda\envs\MSAPI\python.exe
   machine: Windows-10-10.0.22000-SP0

Python deps:
   certifi: 2021.10.08
       pip: 21.2.2
setuptools: 58.0.4
    Cython: None
snowman2 commented 2 years ago

This may be something to ask the PROJ devs about: https://github.com/OSGeo/PROJ

snowman2 commented 2 years ago

Closing for preference is to the PROJ issue.