Is there function to delete the areas of overlap between polygon features to achieve visualized results? enter image description here

Id like to check for each geometry (row) if a geometry is intersected, or in other words if a geometry is overlapped by another. If this is the case Id like "erase" the overlap from the other geometry without creating a hole. When there is no direct way to delete the overlap, is it possible to create new features from the overlaps, and then filter them out by a certain size treshold?

Maybe there is a simple way I did not see but please excuse PostGIS is new to me.

  • Is this related to gis.stackexchange.com/questions/363025/… ?
    – dr_jts
    May 27 '20 at 17:37
  • Yes I'd like to know it in general.
    – DrSnuggles
    May 27 '20 at 17:41
  • 1
    From the picture above, you could split (ST_Split) a polygon p1 with the exterior ring of a polygon p2 if they overlap. So now you have one big polygon p1, one small polygon p1 and the polygon p2: keep only the biggest polygon area grouped by the polygon ID (something like: .... GROUP BY id HAVING(MAX(ST_AREA(geom)))
    – obchardon
    May 28 '20 at 7:46
  • But how do you know which boundary is the correct boundary ?
    – obchardon
    May 28 '20 at 7:49
  • Considering your other questions concerning this issue; what are you going to do with theses buffers? For most tasks other than pure visuals, buffers can (and IMO should) be avoided (e.g. proximity/spatial relation analysis). And for visualizing them, the rendering application will usually do a better job at sorting out border issues than an approach on the geometric level. For reference: check out my answer here for a (different, but related) visual effect, and note the other answer that has a solution on the geometric level, both in QGIS.
    – geozelot
    May 29 '20 at 11:32

I've used this and it is good for detecting overlaps

Check whether table has overlapping polygons, in PostGIS?

Remove the limit and make it into a table as

CREATE Table my.table AS
FROM my_table a
INNER JOIN my_table b ON 
   (a.geom && b.geom AND ST_Relate(a.geom, b.geom, '2********'))
WHERE a.ctid != b.ctid

The table will potentially have the ids on which you can search and come back to your source table, perhaps modify only on that list of ids.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.