pyproj4 / pyproj

Python interface to PROJ (cartographic projections and coordinate transformations library)
https://pyproj4.github.io/pyproj
MIT License
1.06k stars 214 forks source link

Radian flag is ignored #645

Closed espg closed 4 years ago

espg commented 4 years ago

The flag used to work in earlier versions, but currently does not (tested using 2.6.0).

Code Sample, a copy-pastable example if possible

A "Minimal, Complete and Verifiable Example" will make it much easier for maintainers to help you: http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports


import pyproj
# tested with version 2.6.0

p1 = pyproj.Proj(proj='utm',zone=22,ellps='WGS84')

print(p1(511785.0, 7552515.0,inverse=True))
print(p1(511785.0, 7552515.0,inverse=True, radians=True))

# should ***not*** evaluate to true
p1(511785.0, 7552515.0,inverse=True, radians=True) == p1(511785.0, 7552515.0,inverse=True)

Problem description

Radians are needed for great circle distance calculations (i.e., haversine distances, such as when using the sklearn ball tree object). This behavior is new within the last ~2 years; found bug because old scripts stopped working after upgrading pyproj.

Expected Output

Radians. It's a simple calculation to do by hand... but for pipelines, it should continue to work as it used to.

Environment Information

pyproj info: pyproj: 2.6.0 PROJ: 6.3.1 data dir: /nix/store/pkzswj3kj7fbd8v28di06q6j7f1mn6ng-proj/share/proj

System: python: 3.7.6 (default, Dec 18 2019, 19:23:55) [GCC 9.2.0] executable: /nix/store/nlgrx0cl1l87nx0w660lb3jksn9jdca9-python3-3.7.6/bin/python machine: Linux-4.15.0-51-generic-x86_64-with-debian-buster-sid

Python deps: pip: 19.3.1 setuptools: 44.0.0.post20200404 Cython: 0.29.14

Installation method

Using nix; here is the nix derivation, and instructions.

snowman2 commented 4 years ago

Closed via #639