[postgis-users] [mtnclimb at gmail.com: Fwd: Self-intersecting polygon gives ST_IsSimple=true]

Sandro Santilli strk at kbt.io
Wed May 10 10:34:13 PDT 2017


----- Forwarded message from Martin Davis <mtnclimb at gmail.com> -----

Date: Wed, 10 May 2017 10:13:49 -0700
From: Martin Davis <mtnclimb at gmail.com>
To: Sandro Santilli <strk at kbt.io>
Subject: Fwd: [postgis-users] Self-intersecting polygon gives ST_IsSimple=true
In-Reply-To: <CAK2ens1ccH4C9R0wHS9tLqeFyfWT1c2V=u+aNe7Jq8sxCg-+CQ at mail.gmail.com>
X-Spam-Level: 

---------- Forwarded message ----------
From: Martin Davis <mtnclimb at gmail.com>
Date: Wed, May 10, 2017 at 10:13 AM
Subject: Re: [postgis-users] Self-intersecting polygon gives
ST_IsSimple=true
To: Jukka Rahkonen <jukka.rahkonen at latuviitta.fi>, PostGIS Users Discussion
<postgis-users at lists.osgeo.org>, Martin Davis <mtnclimb at gmail.com>


The confusion arises from obsolete Javadoc on the IsSimpleOp class.  In
fact the IsSimpleOp code DOES check polygons for self-intersecting rings,
as stated in the Geometry#isSimple Javadoc.

What happened is that IsSimpleOp was enhanced (in SVN r662 Sept 2012) to
check for polygonal self-intersection, but the class Javadoc was not
updated at that time.

The reasons that IsSimple accepts polygonal input are:

- it is very desirable to allow geometry operations to accept ALL geometry
types, so that explicit type checks are not required by clients
- The IsSimple code was extended to perform a useful function for
polygons.  IsSimple computes a location of a a self-intersection point, so
this can be used with polygons as well as lines (e.g. for visualization
purposes).

To sum up:  the semantics and the Geometry#isSimple Javadoc are correct as
stands.  The class Javadoc for IsSimpleOp needs to be fixed.




On Wed, May 10, 2017 at 4:44 AM, Sandro Santilli <strk at kbt.io> wrote:

> 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.vividso
> lutions/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;
>

----- End forwarded message -----

-- 

  ()   Free GIS & Flash consultant/developer
  /\   https://strk.kbt.io/services.html


More information about the postgis-users mailing list