That seamed to have worked. Here is my implementation of Sandro guidelines:
SELECT ST_Union(v.the_geom) FROM (SELECT ST_MakeValid(St_Snap(t.the_geom, (SELECT ST_SnapToGrid(st_collect(f.the_geom), 0.001) as the_geom FROM (SELECT (ST_DumpPoints(g.the_geom)).geom as the_geom FROM table1 as g) as f), 0.001)) as the_geom FROM table1 as t) as v; 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. With a bigger table ( 701 polygons, 113147 vertices), it takes 762575 ms... 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. Thank you for your help. Alexandre Neto On Fri, Oct 26, 2012 at 10:20 AM, Sandro Santilli <s...@keybit.net> wrote: > On Fri, Oct 26, 2012 at 10:05:29AM +0100, Alexandre Neto wrote: > > Thank you for all the answers. > > > > I did not try the topology, as I need to study its implementation a > little > > better. > > > > I did not found the st_cleanpolygon function and using (St_Buffer, 0) did > > not worked: > > > > The dilate\erode visually corrects the problem, but of course introduce a > > small rounding in the angle introducing a small overlaping with other > > adjacent polygons... > > > > I guess that the tolerance with the GEOS PrecisionModel would be nice, I > > think that is the method used by ArcGIS products to "insure" geometry > > "topology" after aggregation operations. > > > > Any more ideas? > > You may try collecting all vertices of input into a MULTIPOINT, then > ST_SnapToGrid that MULTIPOINT, then ST_Snap each of the input geometries > to the resulting MULTIPOINT, with your desired tolerance. > Finally pass the result trough ST_MakeValid to drop collapsed polygons. > > Should work fine. Let us know. > > --strk; > > http://www.cartodb.com - Map, analyze and build applications with your > data > > ~~ http://strk.keybit.net > > _______________________________________________ > postgis-users mailing list > postgis-users@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users >
_______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users