[postgis-users] Method to remove overlaps in a layer
Sandro Santilli
strk at keybit.net
Thu Mar 15 09:03:51 PDT 2012
On Thu, Mar 15, 2012 at 11:26:22AM -0400, Pierre Racine wrote:
> Hi all,
>
> Anybody know a well documented and efficient method to remove overlaps in a polygon table using PostGIS?
>
> I can think of two cases:
>
> a) I may want to do it on a single table containing overlaps.
>
> b) I may want to do it because I want to update a clean (non-overlapping) table with a new one of smaller extent.
>
> In both cases I would like to be able to define/use a best polygon selection strategy (based on a year attribute for example).
>
> A small detail: I want to do this on a table containing 26 000 000 polygons...
I guess you'd better do this in steps:
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
Hey, step3 is probably correct SQL too ! :)
--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