That seamed to have worked.<div><br></div><div>Here is my implementation of Sandro guidelines:</div><div><br></div><div><div>SELECT ST_Union(v.the_geom)</div><div>FROM</div><div>(SELECT ST_MakeValid(St_Snap(t.the_geom, </div>
<div>        (SELECT ST_SnapToGrid(st_collect(f.the_geom), 0.001) as the_geom</div><div>         FROM (SELECT (ST_DumpPoints(g.the_geom)).geom as the_geom</div><div>               FROM table1 as g) as f),</div><div>        0.001)) as the_geom</div>
<div>FROM</div><div>    table1 as t) as v;</div><div><br></div><div>It's obviously a slow process as it implies 2 sequential reads in the table, it takes 11ms with a very simple table containing only 2 polygons, as it implies 2 sequential reads in the table.</div>
<div><br></div><div>With a bigger table ( 701 polygons, 113147 vertices), it takes 762575 ms...</div><div><br></div><div>Since the problem occurs when I do the input of new polygons, I will try to use this procedures only for the new polygons and the adjacent ones.</div>
<div><br></div><div>Thank you for your help.</div><div><br></div><div>Alexandre Neto</div><br><div class="gmail_quote">On Fri, Oct 26, 2012 at 10:20 AM, Sandro Santilli <span dir="ltr"><<a href="mailto:strk@keybit.net" target="_blank">strk@keybit.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Fri, Oct 26, 2012 at 10:05:29AM +0100, Alexandre Neto wrote:<br>
> Thank you for all the answers.<br>
><br>
> I did not try the topology, as I need to study its implementation a little<br>
> better.<br>
><br>
> I did not found the st_cleanpolygon function and using (St_Buffer, 0) did<br>
> not worked:<br>
><br>
> The dilate\erode visually corrects the problem, but of course introduce a<br>
> small rounding in the angle introducing a small overlaping with other<br>
> adjacent polygons...<br>
><br>
> I guess that the tolerance with the GEOS PrecisionModel would be nice, I<br>
> think that is the method used by ArcGIS products to "insure" geometry<br>
> "topology" after aggregation operations.<br>
><br>
> Any more ideas?<br>
<br>
</div>You may try collecting all vertices of input into a MULTIPOINT, then<br>
ST_SnapToGrid that MULTIPOINT, then ST_Snap each of the input geometries<br>
to the resulting MULTIPOINT, with your desired tolerance.<br>
Finally pass the result trough ST_MakeValid to drop collapsed polygons.<br>
<br>
Should work fine.  Let us know.<br>
<br>
--strk;<br>
<div class="HOEnZb"><div class="h5"><br>
 <a href="http://www.cartodb.com" target="_blank">http://www.cartodb.com</a> - Map, analyze and build applications with your data<br>
<br>
                                       ~~ <a href="http://strk.keybit.net" target="_blank">http://strk.keybit.net</a><br>
<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
</div></div></blockquote></div><br></div>