Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Identify the Bug or Feature request
Fixes #4528
Description of the Change
In the test case attached in the bug report, AWT returns the left and right triangles as separate paths, but the top and bottom triangles are treated as part of the surrounding rectangle by using a self-intersecting path. JTS'
Polygonizer
expects well-behaved input, which includes not allowing these self-intersection paths.To solve this, we now make sure to node our geometry prior to polygonizing. This is done using a
SnapRoundingNoder
to make sure it is robust while also freeing us from having to enforce precision ourselves. And to make sure this sort of problem doesn't fly under the radar in the future, we log any errors that the polygonizer reports.I've tested on some complex geometry and have not noticed any significant slowdown related to this change.Possible Drawbacks
Performance is reduced for expose last path when the paths are long.
Documentation Notes
N/A
Release Notes
This change is