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

Sorted-last-shapely-2-deprecation-warnings #158

Merged
merged 3 commits into from
Apr 10, 2022

Conversation

mattijn
Copy link
Owner

@mattijn mattijn commented Apr 10, 2022

This PR makes reduces the number of warnings from 184 to 0.

It was especially the np.vstack which access the array interface under the hood. Like in the following:

import numpy as np
from shapely import geometry

a = {"type": "LineString", "coordinates": [[0, 0], [1, 0], [2, 0]]}
b = {"type": "LineString", "coordinates": [[0, 0], [1, 0], [2, 0]]}
arr = [geometry.shape(a), geometry.shape(b)]

np.vstack(arr)
<__array_function__ internals>:5: ShapelyDeprecationWarning: The array interface is deprecated and will no longer work in Shapely 2.0. Convert the '.coords' to a numpy array instead.
[1]:
array([[0., 0.],
       [1., 0.],
       [2., 0.],
       [0., 0.],
       [1., 0.],
       [2., 0.]])

Changing to np.vstack([a.coords for a in arr])

@mattijn mattijn merged commit f91611e into master Apr 10, 2022
@mattijn mattijn deleted the sorted-last-shapely-2-deprecation-warnings branch April 10, 2022 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant