question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Transformation grid management

See original GitHub issue
from 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:closed
  • Created 3 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
JuliusFEcommented, Nov 23, 2020

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.

0reactions
snowman2commented, Nov 24, 2020

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Grid Process Approach to Change Management & Culture ...
We stand out by giving people The Power to Change® through timeless skills that transform relationships and culture. Our process consists of six...
Read more >
The Customer Transformation Grid | Elevate Digital
With help from our friends over at Digital Marketer, we've created a Transformation Grid for you to use for your business.
Read more >
Grid Innovations and Digital Transformation
Innovation and the digital transformation of the grid substation are crucial to evolving our ... Grid asset management challenges and solution strategies ...
Read more >
Applying Grid Architecture to Grid Transformation
Grid architecture shows how to layer core system components, such as information management, sensing, and communications systems, that can then ...
Read more >
The Grid Transformation Forum | A Glimpse at the Grid of the ...
Rackliffe : I would highlight distribution grid management, transmission technologies, utility analytics, and distributed energy resources. For example, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found