[geos-devel] [GEOS] #1004: Simplify method provides wrong result

GEOS geos-trac at osgeo.org
Mon Nov 25 14:09:50 PST 2019

#1004: Simplify method provides wrong result
 Reporter:  kamad3      |       Owner:  geos-devel@…
     Type:  defect      |      Status:  new
 Priority:  minor       |   Milestone:
Component:  Default     |     Version:  3.8.0
 Severity:  Unassigned  |  Resolution:
 Keywords:  simplify    |

Comment (by mdavis):

 Copying the comments on the GDAL ticket for posterity:

 There's a few things going on here.

 * The bad output is caused by GEOS trying to rectify an invalid output
 polygon from simplification by using {{{buffer(0)}}}. Obviously that trick
 doesn't always work... ( {{{buffer}}} sometimes keeps the "wrong" lobe of
 a self-crossing polygon)
 * QGIS appears to be using the GEOS {{{TopologyPreservingSimplifier}}},
 which preserves topology by not simplifying vertices which would cause
 invalid output.
 * The PostGIS {{{ST_Simplify}}} uses an internal implementation which can
 produce invalid output. But it also offers
 * In JTS there is a flag on {{{DouglasPeuckerSimplifier}}} which allows
 skipping the area-topology-fixing step. This will give the same output as
 PostGIS {{{ST_Simplify}}}.  Unfortunately the GEOS code doesn't have this

 My suggestion for dealing with this is:

 * The method of forcing valid polygonal output for {{{Simplify}}} is
 problematic, and no simple fix is obvious.  So for now this hack should
 probably be disabled.  Either the flag should be added, or (more simply)
 {{{Simplify}}} should be changed to change its default behaviour.
 * If valid output is required then either use
 {{{TopologyPreservingSimplifier}}} or {{{MakeValid}}}

Ticket URL: <https://trac.osgeo.org/geos/ticket/1004#comment:2>
GEOS <http://trac.osgeo.org/geos>
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite (JTS).

More information about the geos-devel mailing list