0

I have a shapefile with 2745 individual sites/polygons in the Philippines, each site represents a tree planting project, with relevant information (30 attributes to be precise), including the year the site was planted.

However, in QGIS using the Topology Checker, I have identified 167 cases of overlap across sites. I need to fix this so that I do not 'double-count' pixels later when I do my analyses. I'm trying to figure out how to 'cede' the intersection of overlapping polygons to the respective site that was plant earliest in time, ie I have a site that was planted in 2017 whose area = a+b, and another site planted in 2018 whose area is b+c, and so in this case I'd want the 'b' (the intersection/overlap) to go to just the 2017 site. There are some cases where there's 3 sites that overlap, or one site overlaps with two sites separately, and also a few cases where one site is completely enclaved by another.

I've been trying to do this for ages in R to no success, so I'm seeing how I can do this in QGIS.

I tried dissolving the layer whilst leaving the attribute blank so that it would do it simply on geometry, but it just merged all 2745 into 1. Ideally, I also want the site that keeps the 'b' to add to the column "planting_effort_years" to add +1 for each site that overlaps onto it.

If it is relevant, some of the sites have just one polygon, others are multipolygons. I'm adding here some screenshots to visualize some of the overlap error types, where the green is the "a", the red is the "b", and the orange is the "c". The first example is one where the green polygon intersects more than one other polygon (ie northern orange one vs southern orange). The second one is the most common, where two polygons overlap. And the third example is where site 2, ie "b+c" is entirely inside "a+b", and therefore there is no "c".

enter image description here

enter image description here

enter image description here

5
  • 1
    gis.stackexchange.com/questions/466438/…
    – Bera
    Commented Sep 8, 2023 at 18:45
  • An SQL based solution, which can likely be ran in a virtual layer
    – JGH
    Commented Sep 8, 2023 at 19:11
  • @BERA thank you for link, I'm not sure however with the Aggregate function, since unlike the example you linked I have 27 attributes but I only want to 'cede' the overlap to the earliest planted site, ie the minimum in the 'year' column Commented Sep 10, 2023 at 13:48
  • @JGH forgive me but I'm not sure how to get to that window when I have the shapefile as a layer, and not a table like the OP of that question. Commented Sep 10, 2023 at 13:51
  • You can add all attributes you want to keep to aggregate and for example use aggregate function first_value to all of them
    – Bera
    Commented Sep 12, 2023 at 17:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.