pysal / libpysal

Core components of Python Spatial Analysis Library
http://pysal.org/libpysal
Other
259 stars 78 forks source link

Work around GEOS issue in voronoi_frames #693

Closed martinfleis closed 6 months ago

martinfleis commented 6 months ago

While using the new voronoi_frames on a fairly large dataset, I noticed this issue libgeos/geos#1062 plus another where some polygons coming from GEOS were not actually valid, likely due to the same reason. This is a workaround that solves all I faced.

codecov[bot] commented 6 months ago

Codecov Report

Attention: Patch coverage is 50.00000% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 84.9%. Comparing base (018f1e2) to head (72571b2). Report is 7 commits behind head on main.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/pysal/libpysal/pull/693/graphs/tree.svg?width=650&height=150&src=pr&token=wgnkG5Rj0J&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pysal)](https://app.codecov.io/gh/pysal/libpysal/pull/693?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pysal) ```diff @@ Coverage Diff @@ ## main #693 +/- ## ======================================= + Coverage 84.7% 84.9% +0.2% ======================================= Files 141 141 Lines 15200 15206 +6 ======================================= + Hits 12880 12913 +33 + Misses 2320 2293 -27 ``` | [Files](https://app.codecov.io/gh/pysal/libpysal/pull/693?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pysal) | Coverage Δ | | |---|---|---| | [libpysal/cg/voronoi.py](https://app.codecov.io/gh/pysal/libpysal/pull/693?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pysal#diff-bGlicHlzYWwvY2cvdm9yb25vaS5weQ==) | `72.5% <50.0%> (-0.7%)` | :arrow_down: | ... and [6 files with indirect coverage changes](https://app.codecov.io/gh/pysal/libpysal/pull/693/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pysal)
jGaboardi commented 6 months ago

Is this something that might be fixed in the future upstream? If so, should we make a ticket here to check the behavior in the future? Or will the workaround continue to be functional after the upstream issue is resolved?

martinfleis commented 6 months ago

I suppose it will be fixed in upstream. The if clause will be just skipped in that case, like it is in most cases where the issue does not happen right now. This is a very corner case but it was causing an issue when running enclosed_tessellation in momepy.