Transformation grid management
See original GitHub issuefrom pyproj import CRS, Transformer
from pyproj.transformer import TransformerGroup
from pyproj.crs import CompoundCRS, VerticalCRS, Ellipsoid
from pyproj.crs.coordinate_system import VerticalCS
crs_in = CRS('EPSG:8719')
crs_out = CRS('EPSG:4978')
tg = trans_group = TransformerGroup(crs_in, crs_out)
tg.download_grids(verbose=True)
print(tg)
transformer = Transformer.from_crs(crs_in, crs_out)
coord = [6452293.98, 1803484.19, 2319.5]
print('Start coord:')
print(coord)
print('Forward:')
coord_res = transformer.transform(coord[0], coord[1], coord[2])
print(coord_res)
print('Back:')
transformer_back = Transformer.from_crs(crs_out, crs_in)
coord_res = transformer_back.transform(coord_res[0], coord_res[1], coord_res[2])
print(coord_res)
Problem description
I am experimenting with pyproj to transform some coordinate from ‘EPSG:8719’ to ‘EPSG:4978’. My start coordinate is: [6452293.98, 1803484.19, 2319.5] I would expect the pyproj result to be identical (or at least very close to proj result). I build two docker images to install the needed packages and test the coordinate transformations. One image is based on osgeo/proj:7.2.0 (ubuntu 18.04). The second image is build with identical Docker file as osgeo/proj:7.2.0 but is based on ubuntu 20.04 instead of 18.04 (i.e. FROM ubuntu:20.04 as builder and FROM ubuntu:20.04 as runner). If I run proj transformation for this coordinate in both images I get the following result:
docker run pyproj:3.0.0 echo 6452293.98 1803484.19 2319.5 | cs2cs +init=epsg:8719 +to +init=epsg:4978 -2408580.14 -4808738.49 3418372.07 docker run pyproj20.04:3.0.0 echo 6452293.98 1803484.19 2319.5 | cs2cs +init=epsg:8719 +to +init=epsg:4978 -2408580.14 -4808738.49 3418372.07
The results are identical in both cases. Now if I run the above provided pyproj code in both containers I get the following result: ubuntu18.04 pyproj3.0.0: -2408580.7005495424, -4808737.14588357, 3418372.097367031 ubuntu20.04 pyproj3.0.0: -2408592.3930761744, -4808762.950210186, 3418389.578611745
Expected Output
I would expect to at least get result that is similar to proj result in ubuntu20.04. The result of the ubuntu18.04 version is not identical but at least it is close to proj result.
Environment Information
Environment for ubuntu20.04: pyproj -v pyproj info: pyproj: 3.0.0.post1 PROJ: 7.2.0 data dir: /usr/local/lib/python3.8/dist-packages/pyproj/proj_dir/share/proj user_data_dir: /root/.local/share/proj
System: python: 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0] executable: /usr/bin/python3 machine: Linux-5.4.0-53-generic-x86_64-with-glibc2.29
Python deps: pip: 20.0.2 setuptools: 45.2.0 Cython: 0.29.21
Environment for ubuntu18.04: pyproj info: pyproj: 3.0.0.post1 PROJ: 7.2.0 data dir: /usr/share/proj user_data_dir: /root/.local/share/proj
System: python: 3.6.9 (default, Oct 8 2020, 12:12:24) [GCC 8.4.0] executable: /usr/bin/python3 machine: Linux-5.4.0-53-generic-x86_64-with-Ubuntu-18.04-bionic
Python deps: pip: 9.0.1 setuptools: 39.0.1 Cython: 0.29.21
Installation method
All the experiments were performed in docker container. The docker file for creating the container is as follows:
FROM osgeo/proj:7.2.0 # this one is ubuntu18.04, created custom for ubuntu20.04
# install the required packages
RUN apt update && apt install -y software-properties-common
RUN apt update && apt install -y python3 python3-pip
RUN pip3 install Cython
RUN pip3 install pyproj
ADD . /packages
CMD python3 /packages/proj_test.py
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (7 by maintainers)
Well at first glance my ignorant assumption was that if the message says that its ‘Downloading’ it will be downloaded and will work out of the box. In any case I think we can now close this issue. My problem was solved. Thanks very much for all the help.
@JuliusFE, thanks for raising this issue and for being thorough. I think adding some warnings in the documentation for
download_grids
would be appropriate to highlight that it might not download all of the grids you may need.