[postgis-users] Method to remove overlaps in a layer

Sandro Santilli strk at keybit.net
Thu Mar 15 09:59:00 PDT 2012


On Thu, Mar 15, 2012 at 12:56:38PM -0400, Pierre Racine wrote:
> >  1. find out intersecting pairs into cache (id1,id2,geom1,geom2)  2. update cache
> > set geom1 = st_difference(geom1, geom2)  3. update main set geom = c.geom1
> > from cache where id1 = id
> 
> Hum... Life is never that easy.
> 
> That would work if one polygon would always overlap with only one polygon but if one polygon is overlapped by two polygons or more the same polygon as two differences associated with it in the second step and only the last one will remains in the last update...

True, should be an iterative process until "cache" becomes empty.

--strk;

  ,------o-. 
  |   __/  |    Delivering high quality PostGIS 2.0 !
  |  / 2.0 |    http://strk.keybit.net - http://vizzuality.com
  `-o------'




More information about the postgis-users mailing list