Skip to content

1.9.6 and 2.1.0 behave differently in case of impossible transformation #202

@drnextgis

Description

@drnextgis

I'm not sure that this is a right place for this issue but anyway the following code works fine with pyproj 1.9.6:

>>> import pyproj
>>> from functools import partial
>>> from shapely.geometry import Polygon
>>> from shapely.ops import transform
>>> 
>>> project = partial(
...     pyproj.transform,
...     pyproj.Proj(init='epsg:4326'),
...     pyproj.Proj(init='epsg:3857'))
>>> 
>>> g1 = Polygon([(-180, -90), (-180, 90), (180, 90), (180, -90), (-180, -90)])
>>> g2 = transform(project, g1)
>>> print(g2)
POLYGON ((inf inf, inf inf, inf inf, inf inf, inf inf))
>>> pyproj.__version__
'1.9.6'

but fails with the recent 2.1.0:

>>> g2 = transform(project, g1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/denis/satellogic/env/lib/python3.6/site-packages/shapely/ops.py", line 234, in transform
    zip(*func(*izip(*geom.exterior.coords))))
  File "/home/denis/satellogic/env/lib/python3.6/site-packages/pyproj/transformer.py", line 307, in transform
    return Transformer.from_proj(p1, p2).transform(x, y, z, radians)
  File "/home/denis/satellogic/env/lib/python3.6/site-packages/pyproj/transformer.py", line 151, in transform
    self._transformer._transform(inx, iny, inz, radians)
  File "pyproj/_transformer.pyx", line 149, in pyproj._transformer._Transformer._transform
pyproj.exceptions.ProjError: proj_trans_generic error: tolerance condition error

Maybe @sgillies has some thoughts how to deal with it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions