-
Notifications
You must be signed in to change notification settings - Fork 372
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
GEOSTopologyPreserveSimplify returns invalid geometry (47 examples provided) #1180
Comments
Here's the sample set in WKT for easier consumption. One was invalid and I have omitted it. |
For Shapely 1.8.4: For Shapely: 2.0.6 (Stable): We're on Shapely 1.8.4 (I know, I know, very old, there were some breaking changes in Shapely 2.x, but since that didn't resolve this bug, we stuck with 1.8.4... for now). We'd gladly upgrade to the next 2.x release if it includes the latest GEOS with this fix :) |
Back-ported to 3.11 at 5297e1e |
@pramsey: That was fast! 🥳
|
GEOSTopologyPreserveSimplify
can return invalid geometry (see attached 47 test cases). Our current fix is to check if the value returned is valid, if not, we re-run withtolerance / 10
until we get a valid shape. Our default tolerance is0.01
if that's of relevance.47 Test fixtures in .geojson files that cause GEOSTopologyPreserveSimplify to return invalid geometry:
https://github.com/user-attachments/files/17261209/network_as_polygon_edgecase.zip
tree -sh
output of the zip:A test harness with
pytest
testing this functionality viaShapely
is available here: shapely/shapely#2165Related to:
shapely/shapely#2165
The text was updated successfully, but these errors were encountered: