Sunday, 7 July 2019

qgis - Zonal stats for two polygon layers: calculate proportion of feature cover within polygons


In order to calculate land cover diversity within defined patches, I need the coverage proportion of each landcover type for each patch. So I am searching for something similar to the zonal stats tool available for raster-within-polygon calculations.


In contrast to Calculate proportional area of polygon within another layer's polygon, I do not aim to calculate the proportional coverage of single polygons but the total proporional coverage of all polygons representing the same land cover type. Note: land cover types can be represented by more than one polygon within a patch.


enter image description here The screenshot exemplarily shows two patch-polygons (dotted lines) with land cover polygons (different forest and open land types, each represented by a specific signature). For each patch polygon, I need a summary of proportional coverage of each land cover type.


The screenshot shows just a few land cover types, however there are many more - so I seek an "automatic" solution.


the result should be a "proportional coverage of landcover types"-table like this (where the "sum" culumn is not necessary): enter image description here



Answer



I would first create a new field that holds the size of the large polygon, or patch as you name it (ie field name area_patch). I would use the field calculator, see this. Then perform an intersection with the 'patch layer' and the 'land use layer'. QGIS also has an intersection function. This gives you a new vector layer where you again need to create a new field where you calculate the area for each feature again (ie field name area_lu). Next you can use a field calculator to calculate the percentages per polygon (area_lu / area_patch * 100).


Now you have a table where each polygon has a field that has the percentage of the area it fills within each patch. It should also have field value left over from the intersection with the original 'object_id' from the patch layer. Several polygons should have the same original object_id. You can use a 'statistics by category' now using the original object_id and land use type as input. You should be able to sum the values in each field, here the percentages you calculated should be summed.


It might require some time figuring out the tools, but this is how I would do it. Hope it helps.



No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...