locationtech / jts

The JTS Topology Suite is a Java library for creating and manipulating vector geometry.
Other
1.99k stars 443 forks source link

Fix TopologyPreservingSimplifier to prevent jumping components causing incorrect topology #1024

Closed dr-jts closed 11 months ago

dr-jts commented 11 months ago

This PR fixes a long-standing bug in TopologyPreservingSimplifier which created incorrect output due to simplified edges "jumping" over components in the input geometry.

The fix handles both polygonal and linear inputs. (Previously, polygonal inputs with "jumps" produced invalid results. Linear inputs produced results whose topology did not match the input).

Before fix

image

After fix

image

Fixes #428.

Porting this to GEOS will fix the following issues: