locationtech / jts

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

Improve TopologyPreservingSimplifier to prevent edge-disjoint line collapse #925

Closed dr-jts closed 2 years ago

dr-jts commented 2 years ago

Improves TopologyPreservingSimplifier to avoid collapsing edge-disjoint lines together when tolerance is large.

The old code would not maintain the topology of sets of edges-disjoint lines which were closer than the simplification tolerance. In the following example a set of edge-disjoint lines collapse together with a tolerance of 150:

MULTILINESTRING ((0 100, 210 110, 400 100), (0 100, 100 108, 160 130, 310 110, 400 100), (0 100, 140 90, 246 66, 300 90, 400 100))

image

With the improved code the lines are simplified as much as possible while being kept edge-disjoint: image

Note: there is a still an issue which allows fully-disjoint edges to "cross over" each other.