Closed FObermaier closed 8 months ago
It's not clear from the description what this PR does?
Are you suggesting changing the TopologyPreservingSimplifier
behaviour so that it simplifies the endpoint of closed LineString
s? If so, I disagree - the contract is to preserve the endpoints of LineStrings.
Are you suggesting changing the
TopologyPreservingSimplifier
behaviour so that it simplifies the endpoint of closedLineString
s?
Yes.
If so, I disagree - the contract is to preserve the endpoints of LineStrings.
Take a look at the following snipplet:
Geometry ls = read("LINESTRING (220 180, 261 175, 380 220, 300 40, 140 30, 30 220, 176 176, 220 180)");
Geometry lr = read("LINEARRING (220 180, 261 175, 380 220, 300 40, 140 30, 30 220, 176 176, 220 180)");
assertTrue(ls.equals(lr));
assertTrue(ls.equalsExact(lr));
If this is true, then any operation on either of these geometries should give the same result.
If this is true, then any operation on either of these geometries should give the same result.
Not necessarily. The OGC topological model is somewhat limited in terms of real-world requirements, IMHO. That's why the concept of BoundaryNodeRule
was introduced - to give more control over how endpoints are treated.
For an example, consider simplifying a road network that contains "loops" - e.g. turn-arounds modelled as closed LineStrings. In order to preserve network integrity, the endpoints of all lines must be preserved, including those of closed LineStrings.
What could be done is allow the simplify behaviour to be controlled by an option flag. This takes effort and complicates the API, so is there a clear practical use case for this?
You have a point regarding LineString
s in network models.
With the current state of
TopologyPreservingSimplifier
and related classes, theLINEARRING (220 180, 261 175, 380 220, 300 40, 140 30, 30 220, 176 176, 220 180)
simplifies toLINEARRING (30 220, 380 220, 300 40, 140 30, 30 220)
using a tolerance value of40
. (see here)Performing the same operation on
LINESTRING (220 180, 261 175, 380 220, 300 40, 140 30, 30 220, 176 176, 220 180)
givesLINESTRING (220 180, 380 220, 300 40, 140 30, 30 220, 220 180)
.