I have a land use vector layer with polygons representing forest, farming, urban aggregates, etc. Each polygon has a field with its area. I was trying to intersect it with buffers of different diameters (50m, 100m, 500m) around points and then obtain the area of each land use inside that buffer in QGIS 3.2.2.
The problem is the intersect tool in Vector -> Geoprocessing Tools
does not change the field Area
on the resulting intersected layer, rather it persists with the value of the entire polygon, even though only a fraction of it is inside the buffer.
I tried several solutions but none worked to solve this, so I decided on a workaround. On the intersected layer, I added a field $area
which shows the area in map units of each cut polygon and then another column with the percentage, which is the map units of that cut polygon dividing by the overall area of the circular buffer. I won't get the actual area of each land use but at least a percentage of occupation which is good enough.
Now the problem is that for each point there are several fragments of different polygons pertaining to the same land use. I wish to combine for each point the values of the same land use.
On this screenshot, you can see highlighted there are 3 pieces of land use "forest" on the 100m buffer around the same point 24. I wish to merge and sum these percentages and end up with a total percentage for each land use for each point.
Better yet if it were possible to create another table where the elements (lines) are merged by their land use, thus avoiding repeated values and providing a single element and respective total percentage value per land use type per point. On the example above, all three highlighted elements of land use Áreas florestais
of point 24 would be collapsed into a single element with a single value for Point = 24, land use = Áreas florestais
and Perc = sum(0.068+0.037+0.147)
Best Answer
Turns out I found the complete solution for this question by using the aggregate tool (Vector > Geoprocessing tools > Aggregate) for repeated element merging, in addition to @Kazuhito's formula to calculate the combined relative area of more than one element under the same field.
Here's the description of the Aggregate tool on QGIS 3.4.1.
On the Aggregate window, there is an option to dissolve fields.
This allows the merging of several elements having the same field value on the chosen layer for dissolving.
Here's an example, on the original layer, two elements with cellID 6752
and then on the aggregated layer, they are merged into a single element with cellID 6752.
Hope this solution will be useful to someone else.