简体   繁体   中英

PostGIS: Delete polygons that overlap

I have four different polygon shapefiles and need to delete the polygons from polygon "a" that intersect polygons "b,c and d" leaving a table with only polygons in "a" that don't intersect any of the other layers. Is there a way to do this in PostGIS?

a(id,geom) b(id,geom) c(id,geom) d(id,geom)

UseEXISTS() expression, eg:

DELETE 
  FROM <table_a> a
 WHERE EXISTS
     ( SELECT 1
         FROM <table_b> b
        WHERE ST_Intersects(a.geom,b.geom)
     )
    or EXISTS
     ( SELECT 1
         FROM <table_c> c
        WHERE ST_Intersects(a.geom,c.geom)
     )
    or EXISTS
     ( SELECT 1
         FROM <table_d> d
        WHERE ST_Intersects(a.geom,d.geom)
     )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM