-
Notifications
You must be signed in to change notification settings - Fork 573
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
simplify() can return invalid geometries (even with preserve_topology=True) #2165
Comments
The other issues are not related. Shapely is mainly a python wrapper around the C++ library GEOS. For So, it's best to post your issue there as well and reference this issue here for further tracking. |
@theroggy: Thanks for the quick reply. I've posted an upstream issue here: libgeos/geos#1180 |
@theroggy: libgeos/geos#1180 <~~~ The fixes for this have been back ported to GEOS 3.11. Would it be possible to cut a new release? |
The next stap would be that geos cuts a new 3.11 release (3.11.5): https://github.com/libgeos/geos/releases, and then this can be included in new shapely 2.0.7 wheels. FYI: Note that using conda you have more flexibility in the geos version you can install... so that way I've been using geos 3.12 and 3.13 for a while now combined with shapely 2.0.x. |
@theroggy Thanks for the tip! I'm pretty new to Python and I've been wondering about keeping geospatial dependencies pinned at particular versions. |
The fix for this has been Back-ported to 3.11 at libgeos/geos@5297e1e
Expected behavior and actual behavior.
Calling
.simplify(tolerance=0.01, preserve_topology=True)
only returns valid Geometry (as indicated by the docs).Steps to reproduce the problem.
.simplify(tolerance=0.01, preserve_topology=True)
on any of the 47 test cases provided network_as_polygon_edgecase.zipis_valid
on the returned value from simplify -- it'll be falseWorkaround for issue:
pytest Code Validating the Issue
If you place
network_as_polygon_edgecase.zip
intests/fixtures
, the following pytest can verify that Shapely returns an invalid shape for all 47 test cases. (I'm using a zip file because the files are larger than what I'd like to keep track of in my repository).Operating system
Shapely version and provenance
Behavior observed on both
1.8.4
and2.0.6
installed via PDM.The text was updated successfully, but these errors were encountered: