[postgis-users] How to make this invalid polygon valid one

Nicolas Ribot nicolas.ribot at gmail.com
Sat Mar 10 13:18:31 PST 2012


Unioning linestrings is in fact useless here... Splitting initial polygon
ring with duplicate points generates the linestrings used by st_buildArea:

with duplicates as (
    select st_collect(point) as points from (
select distinct (st_dumppoints(geometry)).geom as point
        from test_polygon
        group by (st_dumppoints(geometry)).geom
        having count((st_dumppoints(geometry)).geom)>1
) as foo
) select st_buildArea(
st_difference(st_exteriorRing(t.geometry), points)
)
from duplicates dup, test_polygon t;

Nicolas

On 10 March 2012 21:49, Nicolas Ribot <nicolas.ribot at gmail.com> wrote:

> (sorry for all these spelling mistakes, I should have reread my mail)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120310/2b8d27c6/attachment.html>


More information about the postgis-users mailing list