[postgis-users] Problem with ST_ExteriorRing and ST_contains

didier peeters dpeeter1 at ulb.ac.be
Thu May 20 03:14:55 PDT 2010


Hello Nicolas,

Thanks for this quick and useful answer.  
When I run the ST_IsValidReason on the rings it surprisingly doesn't find any error but when I run it on the original polygon layer I get errors like "Ring Self-intersection[-2.14772 42.5812]" which is what I expected.  

So I will try to find a solution on the mailing list history or maybe find a workaround.  

Didier


Le 19 mai 2010 à 10:51, Nicolas Ribot a écrit :

>> Hi everybody,
>> 
>> 
>> 
>> I'm a postgis new user and I would like to submit here a problem I encounter.  Here's what I do :
>> 
>> from a polygon layer I merge some of them (with ST_UNION) into bigger ones according to an attribute value, then I make an exterior ring (with ST_Collect(ST_ExteriorRing())) around these and then I fill these rings (with ST_Contains) with all the original polygon that are inside ( I do this to have a coherent area without the holes I would have otherwise because of some data particularities).
>> 
>> All this works very fine for 99.9 % of the polygons but fails on filling the rings for a few of them.  When I look at these I see that they have a loop which is a probably due to a wrong geometry in the original polygons.
>> 
>> Does any of you know how to deal with this ?
>> 
>> Thanks for your help
>> 
> 
> Hi,
> You should first check the geometry validity (st_isvalid,
> st_isValidReason) and isolate invalid geometries to correct them
> Some "tricks" can correct them automagically (st_buffer(geom, 0.0) for
> instance) and some programs can help you identifiy invalid geometries
> (Jump for instance, with its validation plugin).
> Mailing list contains useful hints on how to correct invalid geometries.
> 
> HTH
> 
> Nicolas
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list