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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

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

Sandro Santilli-3
----- Forwarded message from Martin Davis <[hidden email]> -----

Date: Wed, 10 May 2017 10:13:49 -0700
From: Martin Davis <[hidden email]>
To: Sandro Santilli <[hidden email]>
Subject: Fwd: [postgis-users] Self-intersecting polygon gives ST_IsSimple=true
In-Reply-To: <CAK2ens1ccH4C9R0wHS9tLqeFyfWT1c2V=[hidden email]>

---------- Forwarded message ----------
From: Martin Davis <[hidden email]>
Date: Wed, May 10, 2017 at 10:13 AM
Subject: Re: [postgis-users] Self-intersecting polygon gives
To: Jukka Rahkonen <[hidden email]>, PostGIS Users Discussion
<[hidden email]>, Martin Davis <[hidden email]>

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

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 <[hidden email]> 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
postgis-users mailing list
[hidden email]