[postgis-users] How to eliminate small gaps produced by ST_union?

Sandro Santilli strk at keybit.net
Fri Oct 26 02:20:52 PDT 2012


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 




More information about the postgis-users mailing list