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.

Round-trip Albers fails with "point not within available datum shift grids"

See original GitHub issue

Code Sample, a copy-pastable example if possible

from pyproj import Transformer, CRS
from pyproj.enums import TransformDirection

lonlat = -74.9, 39.9
to_crs = CRS("esri:102003")
print(repr(to_crs))
tr = Transformer.from_crs("epsg:4326", to_crs, always_xy=True)
print(repr(tr))
albers_pt = tr.transform(*lonlat, errcheck=True)
print(f"Albers: {albers_pt}")
lonlat_rt = tr.transform(*albers_pt, errcheck=False, direction=TransformDirection.INVERSE)
print(f"Round trip: {lonlat} -> {lonlat_rt}")
lonlat_rt2 = tr.transform(*albers_pt, errcheck=True, direction=TransformDirection.INVERSE)

Problem description

When trying to do a round-trip from epsg:4326 to esri:102003 with errcheck=True, I get the following exception:

Traceback (most recent call last):
  File "gis_tst5.py", line 13, in <module>
    lonlat_rt2 = tr.transform(*albers_pt, errcheck=True, direction=TransformDirection.INVERSE)
  File "/opt/conda/lib/python3.8/site-packages/pyproj/transformer.py", line 430, in transform
    self._transformer._transform(
  File "pyproj/_transformer.pyx", line 487, in pyproj._transformer._Transformer._transform
pyproj.exceptions.ProjError: transform error: point not within available datum shift grids

The problem only occurs when using local proj-data or PROJ_NETWORK=ON. I also seem to get correct results when errcheck=False. I’m guessing it’s a PROJ problem, but I didn’t know how to properly test it.

Expected Output

Something like the following, without throwing:

...
Round trip: (-74.9, 39.9) -> (-74.9, 39.900000000000006)

Environment Information

python -m pyproj -v
pyproj info:
    pyproj: 2.6.1.post1
      PROJ: 7.0.0
  data dir: /opt/conda/share/proj

System:
    python: 3.8.5 | packaged by conda-forge | (default, Jul 31 2020, 02:39:48)  [GCC 7.5.0]
executable: /opt/conda/bin/python
   machine: Linux-4.19.76-linuxkit-x86_64-with-glibc2.10

Python deps:
       pip: 20.2.2
setuptools: 49.6.0.post20200814
    Cython: 0.29.21

Installation method

conda

Conda environment information (if you installed with conda):


Environment (conda list):
$ conda list proj
# packages in environment at /opt/conda:
#
# Name                    Version                   Build  Channel
proj                      7.0.0                h966b41f_5    conda-forge
proj-data                 1.0                           1    conda-forge
pyproj                    2.6.1.post1      py38h7521cb9_0    conda-forge

Details about conda and system ( conda info ):
$ conda info

     active environment : base
    active env location : /opt/conda
            shell level : 1
       user config file : /home/jovyan/.condarc
 populated config files : /opt/conda/.condarc
                          /home/jovyan/.condarc
          conda version : 4.8.3
    conda-build version : 3.20.0
         python version : 3.8.5.final.0
       virtual packages : __glibc=2.31
       base environment : /opt/conda  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : /opt/conda/pkgs
                          /home/jovyan/.conda/pkgs
       envs directories : /opt/conda/envs
                          /home/jovyan/.conda/envs
               platform : linux-64
             user-agent : conda/4.8.3 requests/2.24.0 CPython/3.8.5 Linux/4.19.76-linuxkit ubuntu/20.04.1 glibc/2.31
                UID:GID : 1000:100
             netrc file : None
           offline mode : False

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
allencnmcommented, Sep 13, 2020

Thanks for helping to have this resolved so quickly! 😃

0reactions
snowman2commented, Sep 11, 2020

Resolved upstream.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PROJ 7: Behaviour change when transforming an out ... - GitHub
In proj 7 it returns error "point not within available datum shift grids". Proj 7 installed from OSGeo4W (proj-dev, version 7.2.0-39), proj-data ...
Read more >
Solved: Datum shift - Esri Community
Solved: I've just downloaded some DEM rasters off of the USGS National Map for a location in Northern California(near Willows).
Read more >
PROJ coordinate transformation software library - GitHub
14.3 Coordinate reference system xyz is not in the EPSG registry, ... Horizontal grid shift: fix failures on points slightly outside a ...
Read more >
CSRS to NAD83 datum shift with ogr2ogr using grid shift file fails
I solved it! In Linux you do not give the entire path to the grid file, just ./ will suffice. The following command...
Read more >
Proj.4 versus Apache SIS: an accuracy comparison - Geomatys
This category includes datum shifts. Apache SIS and Proj.4 produce the same results when they use the same operation method with the same ......
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