[postgis-users] How to make this invalid polygon valid one
Nicolas Ribot
nicolas.ribot at gmail.com
Sat Mar 10 12:45:06 PST 2012
>
> Hello
>
> I am trying to create a buffer around my polygon, which unfortunately is
> not
> a valid one.
> (reason: "Self-intersection[......]").
>
> This polygon is the output of my calculation that creates from a set of
> connected edges an area, consisting of all edges located on the border.
>
>
> http://postgis.17.n6.nabble.com/file/n4564623/Screen_Shot_2012-03-09_at_10.02.41_PM.png
> Polygon image
>
> can someone tell me, what can I do, to remedy this behavior and to make
> this
> geometry valid
>
> this are the sql statements to reproduce my problem:
> http://postgis.17.n6.nabble.com/file/n4564623/testPolygon.sql
> testPolygon.sql
>
> thanks
>
> Markus
>
>
>
Hi Markus,
An attempt with Pgis 1.5.3:
I saw in a Paul's presentation the power of unioning linestrings together,
in order to generated several line where they intersects (
http://2010.foss4g.org/presentations_show.php?id=3369)
The goal is to use duplicate points from the initial polygon to allow us to
make the difference between these points and the exterior ring of the
polygon, to generates several linestrings that can be passed to
st_buildArea:
The first part (with...) extracts duplicate points (cf img1)
with duplicates as (
select st_collect((st_dumppoints(geometry)).geom) as point
from test_polygon
group by (st_dumppoints(geometry)).geom
having count((st_dumppoints(geometry)).geom)>1
)
select st_buildarea (
st_union(st_difference(st_exteriorRing(t.geometry), point))
) from duplicates, test_polygon t;
The result (img2) is a multipolygon that can be dumped to extract
individual parts, or directly buffered.
(the query is not at all optimized ;) )
Nicolas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120310/5a7441c5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: img1.png
Type: image/png
Size: 35476 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120310/5a7441c5/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: img2.png
Type: image/png
Size: 22854 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120310/5a7441c5/attachment-0001.png>
More information about the postgis-users
mailing list