Hi,
I do not understand this: select ST_IsValid( ST_GeomFromText( 'POLYGON (( 320 620, 460 620, 460 500, 320 620, 320 500, 180 500, 180 620, 320 620 ))' )); Result: "f". select ST_IsValidReason( ST_GeomFromText( 'POLYGON (( 320 620, 460 620, 460 500, 320 620, 320 500, 180 500, 180 620, 320 620 ))' )); Result: "Ring Self-intersection[320 620]" select ST_IsSimple( ST_GeomFromText( 'POLYGON (( 320 620, 460 620, 460 500, 320 620, 320 500, 180 500, 180 620, 320 620 ))' )); Result: "t" Shouldn't ST_IsSimple return "false"? OpenJUMP reports that this polygon is "Not Simple Geometry" I tried PostGIS versions 2.1 and 2.3, both versions give "true". -Jukka Rahkonen- _______________________________________________ postgis-users mailing list [hidden email] https://lists.osgeo.org/mailman/listinfo/postgis-users |
On Fri, May 05, 2017 at 10:28:03AM +0300, Jukka Rahkonen wrote:
> select ST_IsSimple( > ST_GeomFromText( > 'POLYGON (( 320 620, 460 620, 460 500, 320 620, 320 500, 180 500, 180 620, > 320 620 ))' > )); > Result: "t" > > > Shouldn't ST_IsSimple return "false"? OpenJUMP reports that this polygon is > "Not Simple Geometry" > I tried PostGIS versions 2.1 and 2.3, both versions give "true". Polygons are simple by definition, see here: https://locationtech.github.io/jts/javadoc/org/locationtech/jts/operation/IsSimpleOp.html " this means that isSimple cannot be used to test for (invalid) self-intersections in Polygons " --strk; _______________________________________________ postgis-users mailing list [hidden email] https://lists.osgeo.org/mailman/listinfo/postgis-users |
Sandro Santilli wrote 2017-05-08 13:48:
> On Fri, May 05, 2017 at 10:28:03AM +0300, Jukka Rahkonen wrote: > >> select ST_IsSimple( >> ST_GeomFromText( >> 'POLYGON (( 320 620, 460 620, 460 500, 320 620, 320 500, 180 500, 180 >> 620, >> 320 620 ))' >> )); >> Result: "t" >> >> >> Shouldn't ST_IsSimple return "false"? OpenJUMP reports that this >> polygon is >> "Not Simple Geometry" >> I tried PostGIS versions 2.1 and 2.3, both versions give "true". > > Polygons are simple by definition, see here: > https://locationtech.github.io/jts/javadoc/org/locationtech/jts/operation/IsSimpleOp.html > > " this means that isSimple cannot be used to test for (invalid) > self-intersections in Polygons " > > --strk; Ok, it was defined in JTS 1.13 http://javadox.com/com.vividsolutions/jts/1.13/com/vividsolutions/jts/geom/Geometry.html#isSimple() "Valid polygonal geometries are simple, since their rings must not self-intersect. isSimple tests for this condition and reports false if it is not met. (This is a looser test than checking for validity)." And now in JTS 1.15 it is "Polygonal geometries are simple by definition, so isSimple trivially returns true. (Note: this means that isSimple cannot be used to test for (invalid) self-intersections in Polygons. In order to check if a Polygonal geometry has self-intersections, use Geometry.isValid())." I believe that there is some good reason for this change but doesn't it put too much responsibility for the user to know not to test polygons with IsSimple? Why does it accept polygon as input at all? -Jukka Rahkonen- _______________________________________________ postgis-users mailing list [hidden email] https://lists.osgeo.org/mailman/listinfo/postgis-users |
Jukka Rahkonen kirjoitti 2017-05-08 15:48:
> Ok, it was defined in JTS 1.13 > http://javadox.com/com.vividsolutions/jts/1.13/com/vividsolutions/jts/geom/Geometry.html#isSimple() > > "Valid polygonal geometries are simple, since their rings must not > self-intersect. isSimple tests for this condition and reports false if > it is not met. (This is a looser test than checking for validity)." > > And now in JTS 1.15 it is > > "Polygonal geometries are simple by definition, so isSimple trivially > returns true. (Note: this means that isSimple cannot be used to test > for (invalid) self-intersections in Polygons. In order to check if a > Polygonal geometry has self-intersections, use Geometry.isValid())." > > I believe that there is some good reason for this change but doesn't > it put too much responsibility for the user to know not to test > polygons with IsSimple? Why does it accept polygon as input at all? I found alternative documentation about IsSimple from current JTS source code from Geometry - IsSimple https://locationtech.github.io/jts/javadoc/org/locationtech/jts/geom/Geometry.html Perhaps IsSimpleOp is updated but IsSimple not https://locationtech.github.io/jts/javadoc/org/locationtech/jts/operation/IsSimpleOp.html I can see from https://github.com/bjornharrtell/jsts/issues/205 that JTS used to behave like it is now again behaving but it was changed by Dr. JTS in https://sourceforge.net/p/jts-topo-suite/code/662/. I can still find the same comments about polygon validity in https://github.com/locationtech/jts/blob/master/modules/core/src/main/java/org/locationtech/jts/operation/IsSimpleOp.java beginning from line 205 /** * Computes simplicity for polygonal geometries. * Polygonal geometries are simple if and only if * all of their component rings are simple. * * @param geom a Polygonal geometry * @return true if the geometry is simple */ Awaiting what Dr. JTS has to say but perhaps I should ask it through the JTS list. On the other hand, this is not any real problem for me but I am mostly curious. By a fast comparison with documentation of other implementations it is pretty common to interpret that polygons with self-intersecting rings are not simple which does make sense for a layman. If Dr. JTS has changed his mind at least twice the interpretation is obviously not self-evident. -Jukka Rahkonen- _______________________________________________ postgis-users mailing list [hidden email] https://lists.osgeo.org/mailman/listinfo/postgis-users |
Jukka Rahkonen kirjoitti 2017-05-08 17:33:
> Jukka Rahkonen kirjoitti 2017-05-08 15:48: > I can still find the same comments about polygon validity in > https://github.com/locationtech/jts/blob/master/modules/core/src/main/java/org/locationtech/jts/operation/IsSimpleOp.java > beginning from line 205 > > /** > * Computes simplicity for polygonal geometries. > * Polygonal geometries are simple if and only if > * all of their component rings are simple. > * > * @param geom a Polygonal geometry > * @return true if the geometry is simple > */ > I was remembering that JTS list is a bit slow with answers so I compiled JTS from master https://github.com/locationtech/jts. IsSimple with POLYGON ((320 620, 460 620, 460 500, 320 620, 320 500, 180 500, 180 620, 320 620)) gives false so JTS and GEOS have different behavior. I am new with PostGIS project, do the developers consider this as a bug and do you want me to file an issue? If yes, would it be a GEOS bug https://trac.osgeo.org/geos/newticket? -Jukka Rahkonen- _______________________________________________ postgis-users mailing list [hidden email] https://lists.osgeo.org/mailman/listinfo/postgis-users |
In reply to this post by Jukka Rahkonen
On Mon, May 08, 2017 at 03:48:01PM +0300, Jukka Rahkonen wrote:
> > Ok, it was defined in JTS 1.13 http://javadox.com/com.vividsolutions/jts/1.13/com/vividsolutions/jts/geom/Geometry.html#isSimple() > > "Valid polygonal geometries are simple, since their rings must not > self-intersect. isSimple tests for this condition and reports false if it is > not met. (This is a looser test than checking for validity)." > > And now in JTS 1.15 it is > > "Polygonal geometries are simple by definition, so isSimple trivially > returns true. (Note: this means that isSimple cannot be used to test for > (invalid) self-intersections in Polygons. In order to check if a Polygonal > geometry has self-intersections, use Geometry.isValid())." > > I believe that there is some good reason for this change but doesn't it put > too much responsibility for the user to know not to test polygons with > IsSimple? Why does it accept polygon as input at all? This is a good question, I'm adding Martin Davis to the recipients list in case he has pointers to rationale for both the change and the acceptance (JTS does have an IllegalArgumentException too..) --strk; _______________________________________________ postgis-users mailing list [hidden email] https://lists.osgeo.org/mailman/listinfo/postgis-users |
In reply to this post by Jukka Rahkonen
On Mon, May 08, 2017 at 08:49:24PM +0300, Jukka Rahkonen wrote:
> Jukka Rahkonen kirjoitti 2017-05-08 17:33: > >Jukka Rahkonen kirjoitti 2017-05-08 15:48: > > >I can still find the same comments about polygon validity in > >https://github.com/locationtech/jts/blob/master/modules/core/src/main/java/org/locationtech/jts/operation/IsSimpleOp.java > >beginning from line 205 > > > > /** > > * Computes simplicity for polygonal geometries. > > * Polygonal geometries are simple if and only if > > * all of their component rings are simple. > > * > > * @param geom a Polygonal geometry > > * @return true if the geometry is simple > > */ > > > > > I was remembering that JTS list is a bit slow with answers so I compiled JTS > from master https://github.com/locationtech/jts. > IsSimple with POLYGON ((320 620, 460 620, 460 500, 320 620, 320 500, 180 > 500, 180 620, 320 620)) gives false so JTS and GEOS have different behavior. > > I am new with PostGIS project, do the developers consider this as a bug and > do you want me to file an issue? If yes, would it be a GEOS bug > https://trac.osgeo.org/geos/newticket? Yes please, it'd be a GEOS bug but it's also useful to file it as a PostGIS bug (in case there's any shortcircuit there). --strk; _______________________________________________ postgis-users mailing list [hidden email] https://lists.osgeo.org/mailman/listinfo/postgis-users |
Free forum by Nabble | Edit this page |