[PROJ] Wrong geoidgrids no longer causing error

Szekeres István szekeres at iii.hu
Mon Feb 20 02:46:17 PST 2023


To answer my own question (so next time I run into it I can find my answer
:) ) - this specific transform doesn't rely on the geoidgrids parameter, as
it is an xy transform only, and geoidgrids is for z. So quite probably what
happens here is that the older version just tried to load the nonexistant
file but didn't actually used it afterwards, and the new one doesn't even
try to load it as it can decide it is unnecessary.

Istvan


On Wed, Feb 15, 2023 at 5:07 PM Szekeres István <szekeres at iii.hu> wrote:

> Hi,
>
> could you pls help deciding if this is a bug or feature?
>
> I want to move a piece of code from Python 3.10 to 3.11 and updating the
> pyproj version made a unit test that tests for a failure not to work
> anymore, as what was a failure before no longer seems to be it.
>
> The code - note that geoidgrids egm96_25.gtx is intentionally wrong and
> doesn't exist:
>
> from pyproj import Transformer,CRS
>
> crs_current = CRS.from_proj4('+proj=tmerc +lat_0=51 +lon_0=0 +k=1 +x_0=0
> +y_0=0 +datum=WGS84 +units=m +geoidgrids=egm96_25.gtx +vunits=m +no_defs')
> crs_4326 = CRS.from_epsg(4326)
> transformer = Transformer.from_crs(crs_current, crs_4326, always_xy=True)
>
> When running this piece of code in Python 3.10 + pyproj 3.3.1 (=proj
> 8.2.0) results in an exception:
>
> >>> transformer = Transformer.from_crs(crs_current, crs_4326,
> always_xy=True)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File
> "/home/istvan/.local/lib/python3.10/site-packages/pyproj/transformer.py",
> line 573, in from_crs
>     return Transformer(
>   File
> "/home/istvan/.local/lib/python3.10/site-packages/pyproj/transformer.py",
> line 310, in __init__
>     self._local.transformer = transformer_maker()
>   File
> "/home/istvan/.local/lib/python3.10/site-packages/pyproj/transformer.py",
> line 97, in __call__
>     return _Transformer.from_crs(
>   File "pyproj/_transformer.pyx", line 1003, in
> pyproj._transformer._Transformer.from_crs
>   File "pyproj/_transformer.pyx", line 1073, in
> pyproj._transformer._Transformer._init_from_crs
>   File "pyproj/_transformer.pyx", line 809, in
> pyproj._transformer._Transformer._initialize_from_projobj
> pyproj.exceptions.ProjError: Input is not a transformation.: (Internal
> Proj Error: pipeline: Pipeline: Bad step definition: proj=vgridshift (File
> not found or invalid))
>
> Which is IMHO the right behaviour, as the given geoidgrids is wrong.
>
> But when running with Python 3.11 and pyproj 3.4.1 (=proj 9.1.0) this
> doesn't cause any exception and the returned transformer is happily
> transforming coordinates.
>
> Is this a bug or a feature? Shall I create a new issue in the tracker to
> "restore" the old behavior - to make a wrong input result in an error?
>
> Thanks,
> Istvan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/proj/attachments/20230220/bb811d42/attachment-0001.htm>


More information about the PROJ mailing list