Giter VIP home page Giter VIP logo

Comments (6)

BrenBarn avatar BrenBarn commented on May 22, 2024

I just came across this as well. What the heck is going on there?

from pyproj.

timothyb0912 avatar timothyb0912 commented on May 22, 2024

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.

danielramosg avatar danielramosg commented on May 22, 2024

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.

 avatar commented on May 22, 2024

I think Transformer.transform() recently introduced with #189 closes this longstanding issue.

from pyproj.

snowman2 avatar snowman2 commented on May 22, 2024

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.

snowman2 avatar snowman2 commented on May 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.