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