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".
first_value
to all of them