## jts-topo-suite-user

 [Jts-topo-suite-user] Two touching member geometries in a multi polygon reported as invalid From: Martin Tomko - 2014-01-07 00:16:23 Attachments: Message as HTML ```Dear all, and Martin in particular, I think, We are encountering a behaviour that we believe is not following the JTS documentation. This was first identify in PostGis ( therefore using the GEOS port of JTS), and replicated in QGIS with a smaller example. It is a variation on the classical bow-tie problem. We have a MUlTIPOLYGON geometry with two member geometries, and these have touching external LinearRings (in one vertex). Now, following the JTS javadoc, we believe this is ok and satisfies the interpretation of : http://tsusiatsoftware.net/jts/javadoc/com/vividsolutions/jts/geom/MultiPolygon.html “As per the OGC SFS specification, the Polygons in a MultiPolygon may not overlap, and may only touch at single points. This allows the topological point-set semantics to be well-defined.” It is also a common suggestion to change bow-tie geometries into multipolygons ( here is a GEOS piece of documentation, but this has been discussed on this list as well: http://trac.osgeo.org/geos/wiki/GeometryCleaning "POLYGON rings must not self-touch * The classic "bow-tie" polygon would have to be re-written as a "polygon with hole that touches once" * A figure-8 polygon would have to be re-written as a MULTIPOLYGON * Sometimes the figure-8 has one really, really small side, and it's best to just lose those * Similarly sometimes one half of the bow-tie is really small and should just be dropped… … and, POLYGON rings must be properly nested and only touch once “ I have tested this on two very simple WKT examples: 1. Mutlipolygon where two member geometries touch in a single vertex (10 10) - this is our target case MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0)),((10 10,20 10,20 20,10 20,10 10))) Fails the validity test. 1,segment 0 of ring 1 of polygon 0 intersects segment 0 of ring 0 of polygon 1 at 10, 10 1,segment 0 of ring 2 of polygon 0 intersects segment 0 of ring 3 of polygon 1 at 10, 10 1,Geometry has 2 errors. I note that these errors are form the QGIS topology validator, and I also believe that these are not correct reports ( just checking the numbering of rings – there are only 2!). Nowe, I believe that GEOS is used to do this check, hence it should be identical to JTS (and as a member here, I report it here – if a Java example code is needed, I can provide it but I do not currently have a project handy). 2. A Multipolygon where one of the member geometries has a bow tie (vertex occurring twice) [this is a known, invalid case, for completeness] MULTIPOLYGON(((0 0,10 0,10 10,20 10,20 20,10 20,10 10,0 10,0 0)),((30 30,40 30, 40 40,30 40, 30 30))) Fails with the same errors. 1,segments 1 and 6 of line 0 intersect at 10, 10 1,segments 2 and 5 of line 0 intersect at 10, 10 1,Geometry has 2 errors. My question is: is the doc of the JTS/GEOS insufficiently explicit and we canot have touching member geometries, or is this a bug? Thanks, Martin ```
 Re: [Jts-topo-suite-user] Two touching member geometries in a multi polygon reported as invalid From: Martin Davis - 2014-01-07 02:18:02 Attachments: Message as HTML ```I think this must be a bug in QGIS. In JTS the validity test produces the expected results: The MultiPolygon with two polygons touching at a single point is valid The MultiPolygon with a component which self-intersects is invalid My guess is that QGIS is not using the full GEOS validity test, since the error message output is more explicit than produced by GEOS. Could it be that they reimplemented it in order to get more explicit messages, but introduced a bug? (And yes, this does indicate that it would be nice to have more explicit error messages in JTS/GEOS!) Martin On 1/6/2014 4:00 PM, Martin Tomko wrote: > Dear all, and Martin in particular, I think, > We are encountering a behaviour that we believe is not following the > JTS documentation. This was first identify in PostGis ( therefore > using the GEOS port of JTS), and replicated in QGIS with a smaller > example. It is a variation on the classical bow-tie problem. > > We have a MUlTIPOLYGON geometry with two member geometries, and these > have touching external LinearRings (in one vertex). > > Now, following the JTS javadoc, we believe this is ok and satisfies > the interpretation of : > http://tsusiatsoftware.net/jts/javadoc/com/vividsolutions/jts/geom/MultiPolygon.html > > “As per the OGC SFS specification, the Polygons in a MultiPolygon may > not overlap, and may only touch at single points. This allows the > topological point-set semantics to be well-defined.” > > It is also a common suggestion to change bow-tie geometries into > multipolygons ( here is a GEOS piece of documentation, but this has > been discussed on this list as well: > http://trac.osgeo.org/geos/wiki/GeometryCleaning > > "POLYGON rings must not self-touch > > * The classic "bow-tie" polygon would have to be re-written as a > "polygon with hole that touches once" > * A figure-8 polygon would have to be re-written as a MULTIPOLYGON > * Sometimes the figure-8 has one really, really small side, and it's > best to just lose those > * Similarly sometimes one half of the bow-tie is really small and > should just be dropped… > > … and, > POLYGON rings must be properly nested and only touch once “ > > I have tested this on two very simple WKT examples: > > 1. Mutlipolygon where two member geometries touch in a single vertex > (10 10) - this is our target case > > MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0)),((10 10,20 10,20 20,10 20,10 10))) > Fails the validity test. > 1,segment 0 of ring 1 of polygon 0 intersects segment 0 of ring 0 of > polygon 1 at 10, 10 > 1,segment 0 of ring 2 of polygon 0 intersects segment 0 of ring 3 of > polygon 1 at 10, 10 > 1,Geometry has 2 errors. > > I note that these errors are form the QGIS topology validator, and I > also believe that these are not correct reports ( just checking the > numbering of rings – there are only 2!). Nowe, I believe that GEOS is > used to do this check, hence it should be identical to JTS (and as a > member here, I report it here – if a Java example code is needed, I > can provide it but I do not currently have a project handy). > > 2. A Multipolygon where one of the member geometries has a bow tie > (vertex occurring twice) [this is a known, invalid case, for completeness] > MULTIPOLYGON(((0 0,10 0,10 10,20 10,20 20,10 20,10 10,0 10,0 0)),((30 30,40 30, 40 40,30 40, 30 30))) > Fails with the same errors. > 1,segments 1 and 6 of line 0 intersect at 10, 10 > 1,segments 2 and 5 of line 0 intersect at 10, 10 > 1,Geometry has 2 errors. > > My question is: is the doc of the JTS/GEOS insufficiently explicit and > we canot have touching member geometries, or is this a bug? > > Thanks, > Martin > > > > ------------------------------------------------------------------------------ > Rapidly troubleshoot problems before they affect your business. Most IT > organizations don't have a clear picture of how application performance > affects their revenue. With AppDynamics, you get 100% visibility into your > Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! > http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk > > > _______________________________________________ > Jts-topo-suite-user mailing list > Jts-topo-suite-user@... > https://lists.sourceforge.net/lists/listinfo/jts-topo-suite-user > > > No virus found in this message. > Checked by AVG - http://www.avg.com ; > Version: 2013.0.3462 / Virus Database: 3658/6980 - Release Date: 01/06/14 > ```

JavaScript is required for this form.

No, thanks