<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello<br>
<br>
I am trying to create a buffer around my polygon, which unfortunately is not<br>
a valid one.<br>
(reason: "Self-intersection[......]").<br>
<br>
This polygon is the output of my calculation that creates from a set of<br>
connected edges an area, consisting of all edges located on the border.<br>
<br>
<a href="http://postgis.17.n6.nabble.com/file/n4564623/Screen_Shot_2012-03-09_at_10.02.41_PM.png" target="_blank">http://postgis.17.n6.nabble.com/file/n4564623/Screen_Shot_2012-03-09_at_10.02.41_PM.png</a><br>
Polygon image<br>
<br>
can someone tell me, what can I do, to remedy this behavior and to make this<br>
geometry valid<br>
<br>
this are the sql statements to reproduce my problem:<br>
<a href="http://postgis.17.n6.nabble.com/file/n4564623/testPolygon.sql" target="_blank">http://postgis.17.n6.nabble.com/file/n4564623/testPolygon.sql</a><br>
testPolygon.sql<br>
<br>
thanks<br>
<br>
Markus<br>
<br><br></blockquote><div><br></div><div>Hi Markus,</div><div><br></div><div>An attempt with Pgis 1.5.3:</div><div><br></div><div>I saw in a Paul's presentation the power of unioning linestrings together, in order to generated several line where they intersects (<a href="http://2010.foss4g.org/presentations_show.php?id=3369">http://2010.foss4g.org/presentations_show.php?id=3369</a>)</div>
<div><br></div><div>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:</div>
<div><div><br></div><div>The first part (with...) extracts duplicate points (cf img1)</div><div><br></div><div>with duplicates as (</div><div>      select st_collect((st_dumppoints(geometry)).geom) as point</div><div><span class="Apple-tab-span" style="white-space:pre">    </span> from test_polygon </div>
<div><span class="Apple-tab-span" style="white-space:pre">      </span> group by (st_dumppoints(geometry)).geom</div><div><span class="Apple-tab-span" style="white-space:pre">     </span> having count((st_dumppoints(geometry)).geom)>1</div>
<div> ) </div><div> select st_buildarea (</div><div>      st_union(st_difference(st_exteriorRing(t.geometry), point))  </div><div> ) from duplicates, test_polygon t;</div></div><div><br></div><div>The result (img2) is a multipolygon that can be dumped to extract individual parts, or directly buffered.</div>
<div>(the query is not at all optimized ;) )</div><div><br></div><div>Nicolas</div></div>