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

Fix GeometryFixer via buffer-0 noding robustness check #867

Merged
merged 4 commits into from
May 9, 2022

Conversation

dr-jts
Copy link
Contributor

@dr-jts dr-jts commented May 7, 2022

This PR fixes the GeometryFixer failure cases identified in #852.

The GeometryFixer problem is that invalid hole rings in the input are fixed via buffer(0), but the output of buffer(0) is still invalid. This causes the union of the "fixed" holes to fail with a TopologyException.

The fundamental problem is that the fast noding used in the buffer algorithm is non-robust, and thus can produce incorrect topology. In the Overlay code this is handled by checking the correctness of the noding after it is created. This is effective, but does impact performance. This is not done in the buffer algorithm, probably because buffer topology building catches noding errors later on. It hasn't caused any known problems - until this issue.

The fix is to check the fast noding done in buffer. If this check fails, the buffer code retries using a more robust noding strategy. To avoid impacting performance for other buffers the noding check is done only for distance=0.

This fix also contains an improvement to CascadedPolygonUnion to switch to using OverlayNG as the robustness fallback, since the test case was affected by the buffer changes. (This code path will soon be obsolete anyway, once OverlayNG becomes the default.)

NOTE: for some reason GEOS works for these test cases, so this fix does not need to be ported.

Signed-off-by: Martin Davis [email protected]

@dr-jts dr-jts changed the title Fix GeometryFixer via buffer-0 noding fix Fix GeometryFixer via buffer-0 noding robustness check May 7, 2022
@dr-jts dr-jts self-assigned this May 7, 2022
@dr-jts dr-jts marked this pull request as draft May 7, 2022 18:35
dr-jts added 2 commits May 9, 2022 12:07
@dr-jts dr-jts marked this pull request as ready for review May 9, 2022 22:53
@dr-jts dr-jts merged commit c9aa23c into locationtech:master May 9, 2022
@dr-jts dr-jts deleted the fix-geometryfixer-buffer0 branch May 9, 2022 23:28
@jodygarnett jodygarnett added this to the 1.19.0 milestone Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants