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

Updated use of shapely.geometry.Polygon and shapely.geometry.collection.GeometryCollection #1773

Merged
merged 4 commits into from
Dec 14, 2022

Conversation

Adaickalavan
Copy link
Member

@Adaickalavan Adaickalavan commented Dec 13, 2022

  1. Newly released shapely==2.0.0 includes type check which fails when Polygon is instantiated using sequence of Point objects.

    # File: shapely/geometry/polygon.py
    if not np.issubdtype(shell.dtype, np.number):
        # conversion of coords to 2D array failed, this might be due
        # to inconsistent coordinate dimensionality
        raise ValueError("Inconsistent coordinate dimensionality")
    • Hence, Polygon is instantiated using sequence of coordinate pairs instead of sequence of Point objects.
  2. Newly released shapely==2.0.0 deprecates iteration over multi-part geometries.

    • Hence, geoms property is used to access the constituent parts of a multi-part GeometryCollection object.

@Adaickalavan Adaickalavan requested review from Gamenot and removed request for Gamenot December 13, 2022 17:19
@Adaickalavan Adaickalavan changed the title shapely.geometry.Polygon: coordinate pairs instead of Point objects Updated use of shapely.geometry.Polygon and shapely.geometry.collection.GeometryCollection Dec 13, 2022
@Adaickalavan Adaickalavan self-assigned this Dec 13, 2022
@Gamenot
Copy link
Collaborator

Gamenot commented Dec 13, 2022

Does this generalise to previous versions?

@Adaickalavan
Copy link
Member Author

Does this generalise to previous versions?

This works in previous version shapely==1.8.1.

@Adaickalavan Adaickalavan merged commit f85dfb8 into develop Dec 14, 2022
@Adaickalavan Adaickalavan deleted the fix-shapely branch December 14, 2022 17:05
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.

4 participants