[postgis-users] Self-intersecting polygon gives ST_IsSimple=true
Jukka Rahkonen
jukka.rahkonen at latuviitta.fi
Mon May 8 07:33:35 PDT 2017
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-
More information about the postgis-users
mailing list