Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyproj 2.1.3 transform() fails with errcheck=True #249

Closed
cjmayo opened this issue Apr 6, 2019 · 2 comments
Closed

pyproj 2.1.3 transform() fails with errcheck=True #249

cjmayo opened this issue Apr 6, 2019 · 2 comments
Labels

Comments

@cjmayo
Copy link
Contributor

cjmayo commented Apr 6, 2019

#228 introduced a check for the return value of proj_trans_generic which is saved as err_count although it is described as "Number of transformations completed" in PROJ:
https://github.com/OSGeo/proj.4/blob/e87b3744350baca2b7fe35070e621a6b45bcbf67/src/4D_api.cpp#L353

(proj_trans_array returns 0 if all coordinates are transformed without error, otherwise returns an error number:
https://github.com/OSGeo/proj.4/blob/e87b3744350baca2b7fe35070e621a6b45bcbf67/src/4D_api.cpp#L282)

This code:

from pyproj import Proj, transform

p1 = Proj(init="epsg:4326")
p2 = Proj(init="epsg:27700")

print(transform(p1, p2, 1.716073972, 52.658007833, errcheck=True))

now fails with:

  File "/usr/lib/python3.7/site-packages/pyproj/transformer.py", line 367, in transform
    xx=x, yy=y, zz=z, tt=tt, radians=radians, errcheck=errcheck
  File "/usr/lib/python3.7/site-packages/pyproj/transformer.py", line 180, in transform
    inx, iny, inz=inz, intime=intime, radians=radians, errcheck=errcheck
  File "pyproj/_transformer.pyx", line 144, in pyproj._transformer._Transformer._transform
pyproj.exceptions.ProjError: 1 proj_trans_generic error(s)

As per this comment #208 (comment), a return value of 0 may be an error (or just there was nothing to transform).
But you would expect a positive integer result on a successful transformation as above?

@snowman2
Copy link
Member

snowman2 commented Apr 6, 2019

@kbevers, can you clarify this?

@snowman2
Copy link
Member

snowman2 commented Apr 6, 2019

Nevermind, this is correct. I misinterpreted this and is a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants