Tag Archive | raster statistics

LecoS update – Landcover Polygon overlay

Hi folks,

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.

The green color is classified as mature forest with >= 60% tree cover

The green color is classified as mature forest with >= 60% tree cover

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.lecosBatchClass

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:

SRTM DEM for the vicinity of Korup NP.

SRTM DEM for the vicinity of Korup NP.

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:


As you can see in nearly all PA is a very high percentage of over 60% mature tree cover

On the GIS-Stackexchange forum are dozens of questions ([1],[2],[3],[4]) 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.

Good night šŸ™‚

First glimpse of a new QGIS plugin. Land cover statistics for classified raster shapes

Since last week i spend my evenings in order to code a new plugin for the QGIS community. It deals with Land cover analysis of classified raster shapes such as the CORINE dataset.

The plugin is named LecoS, which stands for Landscape Ecology Statistics, and is able to compute some of the often used FRAGSTAT metrics directly in QGIS (FRAGSTAT is only available for Windows and don’t work on many Linux machines without major reconfigurations). This includes for example the mean patch area or the number of identified patches per class (like the number of forest patches in an agricultural matrix). More metrics will be added in the feature. The user can choose if he wants to compute a single or several metrics in a row. Additionally i want to include the possibility to define a custom metric for special calculations in order to add flexibility.

LecoS - Landscape Ecology Statistics

Displays the graphical surface of my new plugin and a classified forest cover raster in the background.

I will release the plugin in the near future. Although it is already running and basically working there are a lot of little bugs and the majority of metrics still needs to be implemented.

Things to be done

  • Adding more metrics (for instance total edge length or the landscape division index)
  • Designing the GUI surface for the Custom metric calculation (will be awesome)
  • Ugly Bug hunting
  • Adding a batch processor for features of masked vector shapes

Stay tuned!

Sussex Research Hive

Supporting the research community at the University of Sussex

Small Pond Science

Research, teaching, and mentorship in the sciences

Landscape Ecology 2.0

intersecting landscape ecology, open science, and R


The Research Blog of IIASA

Jƶrg Steinkamps Blog

Mainly things about R, Linux and vegetation modeling

Amy Whitehead's Research

the ecological musings of a conservation biologist

Michael McCarthy's Research

School of BioSciences, The University of Melbourne

The Rostrum

science, statistics, policy and more


Environmental Change - Understand, Predict, Adapt

Dynamic Ecology

Multa novit vulpes


METeorological Visualisation Utilities using R for Science and Teaching

A BirderĀ“s Blog

"Everybody loves what they know"


A new metric to quantify biodiversity response to fragmentation

Trust Me, I'm a Geographer

Using Technology to Explore Our World

Duncan Golicher's weblog

Research, scripts and life in Chiapas