Comments (6)
I just came across this as well. What the heck is going on there?
from pyproj.
I also had a problem today when I wished to use the support for arrays but encountered the following error when passing an array of shape n,2 to the projection instance: ValueError: need more than 1 value to unpack.
The documentation should at least be changed so as not to mislead people into thinking that there is support for arrays.
from pyproj.
Same error for me. Can someone give an explanation of why numpy arguments are no longer supported? It would help a lot if fixed.
from pyproj.
I think Transformer.transform() recently introduced with #189 closes this longstanding issue.
from pyproj.
Here is the current recommended method to transform 2D numpy arrays with pyproj 2.x:
>>> from shapely.geometry import LineString, Point
>>> import numpy
>>> ll = LineString([Point(ii, ii) for ii in numpy.arange(0, 90, 0.01)])
>>> points = numpy.asarray(ll)
>>> points
array([[0.000e+00, 0.000e+00],
[1.000e-02, 1.000e-02],
[2.000e-02, 2.000e-02],
...,
[8.997e+01, 8.997e+01],
[8.998e+01, 8.998e+01],
[8.999e+01, 8.999e+01]])
>>> from pyproj import Transformer
>>> transformer = Transformer.from_crs("epsg:4326", "epsg:3857")
>>> points_3857 = numpy.empty(points.shape)
>>> points_3857[:, 0], points_3857[:, 1] = transformer.transform(points[:, 0], points[:, 1])
>>> points_3857
array([[0.00000000e+00, 0.00000000e+00],
[1.11319491e+03, 1.11319491e+03],
[2.22638982e+03, 2.22638986e+03],
...,
[1.00154146e+07, 5.26064404e+07],
[1.00165278e+07, 5.51925525e+07],
[1.00176410e+07, 5.96135402e+07]])
from pyproj.
I believe with #38 and #4 (comment), this issue has been resolved. Feel free to continue the discussion if you have further questions.
from pyproj.
Related Issues (20)
- 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
- WHL: Window x64 builds failing HOT 7
- MGA94 and MGA2020 unexpected transformation HOT 7
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.