|
Geometry : |
Subject: [ggl] is_simple is_valid
From: Mateusz Loskot (mateusz)
Date: 2009-10-04 12:02:55
Barend Gehrels wrote:
> Hi,
>
> 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.
> (http://www.vividsolutions.com/JTS/javadoc/com/vividsolutions/jts/geom/Geometry.html#isSimple())
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
(http://postgis.refractions.net/pipermail/postgis-users/2004-April/004507.html):
"You should ensure all your geometries are valid before using analytic
functions"
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?
http://postgis.org/documentation/manual-1.4/ch04.html#OGC_Validity
> 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.
> System.ArgumentException:
> 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.
Best regards,
-- Mateusz Loskot, http://mateusz.loskot.net Charter Member of OSGeo, http://osgeo.org
Geometry list run by mateusz at loskot.net