Subject: [ggl] is_simple is_valid
From: Mateusz Loskot (mateusz)
Date: 2009-10-04 12:02:55
Barend Gehrels wrote:
> I'm looking at self-intersections to implement the function is_simple
> (based on blocks we already have). But I'm what confused about the name.
> According to OGC: IsSimple (): Integer Returns 1 (TRUE) if this
> geometric object has no anomalous geometric points, such as self
> intersection or self tangency. The description of each instantiable
> geometric class will include the specific conditions that cause an
> instance of that class to be classified as not simple.
> JTS says: Valid polygonal geometries are simple by definition, so
> isSimple trivially returns true.
Yes, but the result is not well defined for invalid geometries, so
isSimple may result true for non-simple && invalid geometry.
Here is two points exaplnation provided by Martin - JTS guru
"You should ensure all your geometries are valid before using analytic
The implication is:
if (is_valid(geometry) && is_simple(geometry))
... assumed simple
> The PostGIS implementation give TRUE back to all self-intersecting
> polygons that I try.
Can you give WKT of simple example of such polygon?
What version of PostGIS do you use?
> The function isvalid returns false for self-intersecting polygons.
Have you compared your geometries with simple vs valid explained here?
> SQL Server throws for issimple at self-intersections:
> System.ArgumentException: 24144: This operation cannot be completed
> because the instance is not valid. Use MakeValid to convert the instance
> to a valid instance. Note that MakeValid may cause the points of a
> geometry instance to shift slightly.
> at Microsoft.SqlServer.Types.SqlGeometry.ThrowIfInvalid()
> at Microsoft.SqlServer.Types.SqlGeometry.STIsSimple()
> So it is often called isvalid (or is_valid). But I cannot find that in
> OGC specs (looked a.o. in 06-103r3 (still candidate?))
AFAR, details are in SQL/MM specification.
For example, not closed polygon is invalid.
-- Mateusz Loskot, http://mateusz.loskot.net Charter Member of OSGeo, http://osgeo.org
Geometry list run by mateusz at loskot.net