[postgis-users] Problem with ST_ExteriorRing and ST_contains
Nicolas Ribot
nicolas.ribot at gmail.com
Wed May 19 01:51:03 PDT 2010
> 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
More information about the postgis-users
mailing list