[postgis-users] Polygon validity

Martin Davis mbdavis at refractions.net
Wed Mar 31 09:57:43 PDT 2010


So you're saying that any geometry which contains consecutive duplicate 
points is invalid?

This is a pretty major change to validity semantics. 

(As a side note, I wouldn't say that validity doesn't apply to linear 
features - just that there are few constraints on what constitutes a 
valid linear feature.)

Another thing to consider - if you change the semantics of isSimple to 
report false for linestrings containing duplicate points, then you have 
no way of telling the difference between linestrings which contain true, 
topological self-intersections and ones which just happen to contain a 
topologically irrelevant duplicate point.  So there should probably be a 
function which detects *just* duplicate points, to allow users to 
differentiate these two cases.  And in that case, why not just leave the 
semantics of isSimple the way it is, and users can use either or both  
functions as needed?

Kevin Neufeld wrote:
> On 3/30/2010 11:46 PM, Andrea Peri wrote:
>> You can use the ST_IsSimple to know if a geometry is simple-feature.
>>
>> If true it is simple-feature.
>>
>> After, if you geometry is ST_IsSimpe = true,
>> you can test with ST_IsValid , to detect eventually invalidity for 
>> geometry.
>>
>> So you can detect if it is a simple-feature valid geometry.
>>
>
> This is often something that is easily misunderstood.  So, to be 
> clear, according to the OGC specs, simplicity really *only* applies to 
> point and linear features ([multi]point, [multi]linestrings).  
> Validity on the other hand *only* applies to areal features 
> ([multi]polygons).  I put together some thoughts [1] a while back on 
> this.
>
> The OGC specs aren't totally clear regarding duplicate points in 
> linestrings, just that "has no anomalous geometric points, such as 
> self intersection or self tangency" and "is simple if it does not pass 
> through the same point twice". The developers at the time decided that 
> this does not include duplicate points.  I suppose one could argue 
> either way, but to me this really does include duplicate points.
>
> PostGIS also somewhat subscribes to the SQL/MM specifications.  In 
> there I read "is not simple if any interior point has the same 
> location as another interior point or a point on the boundary".  To 
> me, this is more clear and, Rykov, I think you're right, ST_IsSimple 
> really should not allow duplicate points.  I'll put in a ticket.
>
> So, simplicity is for lines and points.
> A *polygon* is *valid* iff all the underlying linear features are 
> *simple* (like no figure 8's in the boundary) and also follows several 
> other rules (like the inner rings being contained within the exterior 
> ring, etc).
>
> Rykov, this is why your polygon passes validity - currently PostGIS 
> does not include duplicate points in linestrings (the boundary of your 
> polygon) as non-simple.
>
> Cheers,
> Kevin
>
> [1] http://postgis.refractions.net/docs/ch04.html#OGC_Validity
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>

-- 
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022




More information about the postgis-users mailing list