pyproj
pyproj copied to clipboard
TransformerGroup does not handle cases where both the allow_superseded and always_xy user arguments is used
Example code
Ex. 1 TransformerGroup fails to list up available transformations when specifying both always_xy and allow_superseded
from pyproj.transformer import TransformerGroup
TransformerGroup("EPSG:4230", "EPSG:4326", allow_superseded=True, always_xy=True).transformers
Outputs:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/pyproj/transformer.py", line 207, in __init__
super().__init__(
File "pyproj/_transformer.pyx", line 241, in pyproj._transformer._TransformerGroup.__init__
File "pyproj/_transformer.pyx", line 602, in pyproj._transformer._Transformer._from_pj
File "pyproj/_transformer.pyx", line 653, in pyproj._transformer._Transformer._init_from_crs
File "pyproj/_transformer.pyx", line 359, in pyproj._transformer._Transformer._initialize_from_projobj
pyproj.exceptions.ProjError: Input is not a transformation.
Ex.2 TransformerGroup should return 36 available transformations when allow_superseded not defined
ct_lst = TransformerGroup("EPSG:4230", "EPSG:4326").transformers
print(len(ct_lst))
Outputs:
36
Ex.3 TransformerGroup should return 37 available transformations when allow_superseded is set to True
ct_lst = TransformerGroup("EPSG:4230", "EPSG:4326", allow_superseded=True).transformers
print(len(ct_lst))
Outputs:
37
ct_lst = TransformerGroup("EPSG:4230", "EPSG:4326", allow_superseded=True).transformers print(len(ct_lst))
Problem description
TransformerGroup fails to a create a list of with all available transformation objects when the user set both always_xy and allow_superseded equals True.
Environment Information
pyproj version 3.6.1 python 3.11
Installation method
pip wheel
An issue is created in Proj GitHub repo.