LecoS update – Landcover Polygon overlay
it’s already late at night and after nearly 4 hours of confused crap coding i finally managed to implement a new amazing feature in my QGIS plugin LecoS. Up to now it was only possible to calculate the landcover for a single raster. However most people usually want to have the values for their respective plots, points of interests, sites, … . For this reason i coded the new Polygon overlay tool, which could extract raster values and save them directly to the vector layers attribute table.
Here is an example of the new features with some of the data mentioned in my previous post about the horrific Herakles farm palm oil project directly in the vicinity of some of the last and oldest protected rainforests belonging to a biodiversity hotspot, the Guinean Forests of West Africa.
Quite often during the campaign emerged the question how much of the protected area is still covered by mature forest trees. I want to resolve this question (in a admittedly very imprecise way) and downloaded a classified raster from the CARPE project, which displays the forest cover in the region. I furthermore added the shapes of the 4 largest protected areas in the vicinity. Now i open the new Batch polygon overlay tool in the LecoS menu (Menubar -> raster) and choose the options as displayed below. It now calculates the total proportion of the first class (mature tree cover >= 60%) for each vector feature (national park). Results are added directly to the shapes attribute table.
Although my plugin was originally designed just to analyse classified raster images, i furthermore implemented some basic methods to extract underlying raster values to polygons. Here is a simple example with the previous shapes:
I’ve downloaded a SRTM Digital Elevation Model for the vicinity of Korup National park. Like before i added the geometries of all major protected areas in the area. Now i simply want to extract the mean Height from the SRTM DEM for each protected Area.
This could be achieved by starting the “Landcover polygon overlay tool”, select the raster and vector layer (beforehand make sure that they have the same spatial projection) and then choose NO as answer in the central combobox. Choose “Mean of Raster values” and click on OK.
The Overlay tool will directly add the calculated values to the attribute table for each vector feature. However QGis doesn’t update the attribute table for some reason and therefore you have to load in your shapefile to the QGis layer browser again. Don’t worry, the values are most likely being saved in the attribute table. The column name is always a combination of the ras_ + the used method, ergo LCprop for Landcover Proportion (to keep it short).
For the simple example above the results look like this:
On the GIS-Stackexchange forum are dozens of questions (,,,) regarding this topic and I hope that this update will come in handy to calculate something like the sum or the mean of all the values from a underlying raster shape per polygon feature. If you have a point-layer you should use the very good Point-Sampling Plugin instead, which is also available in QGis plugin downloader.