[geos-devel] [GEOS] #1064: Topology preserve simplify: unexpected behavior on similar polygons

GEOS geos-trac at osgeo.org
Sat Oct 31 17:04:32 PDT 2020


#1064: Topology preserve simplify: unexpected behavior on similar polygons
------------------------+--------------------------
 Reporter:  uclaros     |      Owner:  geos-devel@…
     Type:  defect      |     Status:  new
 Priority:  minor       |  Milestone:
Component:  Default     |    Version:  master
 Severity:  Unassigned  |   Keywords:
------------------------+--------------------------
 When simplifying a polygon, the first/last vertex is not removed even when
 within the threshold.
 The following WKT polygons are essentially the same polygon, each time
 with a different first/last vertex:

 {{{
 Polygon((0 42, 0 100, 42 100, 100 42, 42 42, 0 42))
 Polygon((0 100, 42 100, 100 42, 42 42, 0 42, 0 100))
 Polygon((42 100, 100 42, 42 42, 0 42, 0 100, 42 100))
 Polygon((100 42, 42 42, 0 42, 0 100, 42 100, 100 42))
 Polygon((42 42, 0 42, 0 100, 42 100, 100 42, 42 42))
 }}}

 simplifying those polygons with a threshold of 1 should give the same
 result, ie remove the vertex at (42,42) but in the last case this does not
 happen and the input polygon is returned untouched.

 If we remove the vertex at (0,100) and rerun the test:
 {{{
 Polygon((0 42, 42 100, 100 42, 42 42, 0 42))
 Polygon((42 100, 100 42, 42 42, 0 42, 42 100))
 Polygon((100 42, 42 42, 0 42, 42 100, 100 42))
 Polygon((42 42, 0 42, 42 100, 100 42, 42 42))
 }}}
 then only the second polygon gives the correct result, all the others are
 returned untouched

 Tested in QGIS with geos 3.9.0dev :
 {{{
 QgsGeometry.fromWkt('Polygon((0 42, 42 100, 100 42, 42 42, 0
 42))').simplify(1)
 QgsGeometry.fromWkt('Polygon((42 100, 100 42, 42 42, 0 42, 42
 100))').simplify(1)
 QgsGeometry.fromWkt('Polygon((100 42, 42 42, 0 42, 42 100, 100
 42))').simplify(1)
 QgsGeometry.fromWkt('Polygon((42 42, 0 42, 42 100, 100 42, 42
 42))').simplify(1)

 QgsGeometry.fromWkt('Polygon((0 42, 0 100, 42 100, 100 42, 42 42, 0
 42))').simplify(1)
 QgsGeometry.fromWkt('Polygon((0 100, 42 100, 100 42, 42 42, 0 42, 0
 100))').simplify(1)
 QgsGeometry.fromWkt('Polygon((42 100, 100 42, 42 42, 0 42, 0 100, 42
 100))').simplify(1)
 QgsGeometry.fromWkt('Polygon((100 42, 42 42, 0 42, 0 100, 42 100, 100
 42))').simplify(1)
 QgsGeometry.fromWkt('Polygon((42 42, 0 42, 0 100, 42 100, 100 42, 42
 42))').simplify(1)
 }}}

-- 
Ticket URL: <https://trac.osgeo.org/geos/ticket/1064>
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