Comments (4)
Results from pyproj 1.9.5.1 Python version 3.4.3 using xonsh.
Results of the "First in degrees" (leaving the variable names out):
(-66.53059478766228, 75.65363415556968, 4164192.7080994677)
Results of the "Now in radians":
(-3811.9222898281223, 4334.633941940914, 4164192.7080994677)
You basically did this--which seems correct to me--which gives a rather large numbers.
>>> math.degrees(-3811.9222898281223)
-218407.059038996
>>> math.degrees(4334.633941940914)
248356.2306073695
If I do this, it matches the degrees. Seems a bit strange.
>>> math.radians(-3811.9222898281223)
-66.53059478766228
>>> math.radians(4334.633941940914)
75.65363415556968
Perhaps there is wrong conversion is being performed in the code. I really don't know. I'm not as familiar with the Geod class. Here is the documentation for the geodesic.h library, which the functions only deals with degrees. So, the radians conversions are pyproj feature.
from pyproj.
I've only verified the inv() changes, but the following diff seems to help - I'm working on unit test cases at the moment.
diff --git a/_proj.pyx b/_proj.pyx
index e0c0775..b331471 100644
--- a/_proj.pyx
+++ b/_proj.pyx
@@ -541,9 +541,9 @@ cdef class Geod:
az1 = azdata[i]
s12 = distdata[i]
else:
- lon1 = _dg2rad*lonsdata[i]
- lat1 = _dg2rad*latsdata[i]
- az1 = _dg2rad*azdata[i]
+ lon1 = _rad2dg*lonsdata[i]
+ lat1 = _rad2dg*latsdata[i]
+ az1 = _rad2dg*azdata[i]
s12 = distdata[i]
geod_direct(&self._geod_geodesic, lat1, lon1, az1, s12,\
&plat2, &plon2, &pazi2)
@@ -561,9 +561,9 @@ cdef class Geod:
latsdata[i] = plat2
azdata[i] = pazi2
else:
- lonsdata[i] = _rad2dg*plon2
- latsdata[i] = _rad2dg*plat2
- azdata[i] = _rad2dg*pazi2
+ lonsdata[i] = _dg2rad*plon2
+ latsdata[i] = _dg2rad*plat2
+ azdata[i] = _dg2rad*pazi2
def _inv(self, object lons1, object lats1, object lons2, object lats2, radians=False):
"""
@@ -621,8 +621,8 @@ cdef class Geod:
if ps12 != ps12: # check for NaN
raise ValueError('undefined inverse geodesic (may be an antipodal point)')
if radians:
- lonsdata[i] = _rad2dg*pazi1
- latsdata[i] = _rad2dg*pazi2
+ lonsdata[i] = _dg2rad*pazi1
+ latsdata[i] = _dg2rad*pazi2
else:
lonsdata[i] = pazi1
latsdata[i] = pazi2
from pyproj.
I did a little bit of comparing the code between 1.8.9 and 1.9.5.1. The differences included the the geodesic library is used in 1.9.5.1, where the Proj.4 had its own native pj_fwd
and pj_inv
functions (which are now "obsolete"). Proj.4 native functions used radians as their units.
When code was converted, the conversion factors were left alone instead of being switched.
from pyproj.
Thanks Micah,
that seems to match the fix, which essentially converts from radians to degrees and then back to radians (instead of the other way around).
from pyproj.
Related Issues (20)
- DeprecationWarning: pkg_resources is deprecated as an API. HOT 1
- Support for deprecated and non-deprecated objects HOT 3
- Invert lat lon "Transformer" HOT 1
- Internal Proj Error: proj_create: unrecognized format / unknown name HOT 4
- Inverted x/y for transformation from WSG84 to LV95 (EPSG:2056) HOT 3
- muslinux wheel missing HOT 1
- test_azimuthal_equidistant fails with PROJ 9.4.0 HOT 1
- test failure in test_crs_cf.py HOT 2
- Add proj_query_geodetic_crs_from_datum HOT 2
- 3.6.1: pytest fails in `test/crs/test_crs_cf.py::test_azimuthal_equidistant` unit HOT 1
- A question about pyproj/_datadir.pyx HOT 2
- geometry_area_perimeter limitations not documented HOT 1
- Calculate area of arbitrary polygon on Earth's surface HOT 4
- Interrupted Mollweide gives wrong result on inverse projections of some lat/lons. HOT 1
- test_datum__from_epsg fails with PROJ 9.4.1 HOT 4
- Proj4 export from a bound CRS object fails HOT 4
- Antipodes don't match when calculated numerically HOT 7
- Bad_alloc with pyroj import in QGIS plugin
- Conversion of array to scalar when transforming 1 element arrays leads to DeprecationWarning HOT 3
- Small memory leak HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyproj.