LecoS – Land cover statistics is a plugin for the QGIS GIS software suite. LecoS originally stands for Landscape ecology statistics, but it can do a lot more than that. It converts classified raster layers to arrays using the powerful numpy library. Based on a Connected Component Labeling approach it further identifies class patches and calculates landscape metrics. The user can choose to calculate single or several metrics for the raster classes. Recent versions of LecoS also include a polygon-overlay (BatchOverlay) tool, which allows the calculation of landscape metrics per polygon feature. I also created the Landscape Modifier, a nifty tool to extract edges, increase or decrease or close holes in raster-patches. Since version 1.9 most LecoS functions are available within the QGIS processing framework.
LecoS is released under a general GPL license v3 and is free of charge for everyone. But please notice that this piece of software is under development and the author takes no responsibility for bugs or miscalculations. So please verify any results independently or with a common sense.
Example use case:
-> Download the current CORINE 2006 dataset (and the provided qgis colourmap) and load them into QGIS.
-> Crop to an area of interest. In my case i quickly draw a polygon over the city of Marburg, Germany and croped the landcover raster via the gdalwarp utility using the polygon as mask layer. The CORINE nodata value is -999. See the result below.
-> Now open the LecoS Land cover statistic gui via the menu (Raster/Landscape Ecology/Land cover statistics). Choose the new croped raster layer and check if the cellsize is correct (CORINE has a spatial resolution of 100m per cell). You can choose “Direct value output” just for information (in a small dialog) or save the results in a csv file for further processing.
As for me i want to save the results and calculate the following metrics from the “Select multiple Metrics” tab:
-> Now run the program and import the results in a spreadsheet software of your choice (Excel, Libreoffice).
The class values represent the grid values in your raster layer, while the other columns are the metrics you calculated. You can lookup the class values in the clc2006 legend table. As you can see in my example class number 12 (Non-irrigated arable land) is the most abundant land cover in the vicinity of Marburg. It makes up nearly 38 % of all cover types and is represented by 28 unique patches in the croped raster layer.
Example use case for the Landscape Modifier -> Here
Another example use case can be seen in this prePrint article about LecoS.
Before you install make sure that scipy, numpy and pil are installed! Otherwise the plugin won’t work!
Install via the QGIS Plugin Downloader or manual. Manual means that you download the Archiv and extract the folder to the QGIS Plugin dir (~/.qgis/python/plugins/ on Linux machines and (qgis_install folder)/python/plugins on Windows). In both cases you need to have the scientific libraries numpy and scipy installed!
If you did not consciously install them (default is “no” on Windows), than you’ll likely see error messages after startup.
- To install the libraries on Linux systems, just download them with your package manager (python-scipy, python-numpy, python-pil) or compile them system wide. They have to be available inside your QGIS python environment.
- To install them on Windows download the OSGEO4W Installer , select advanced Install, search for the libraries python-numpy, python-scipy and python-imaging and check them all (besides checking the qgis binaries). Here is quick and dirty tutorial how to install LecoS on Windows XP using the OSGEO4W installer: 24072013_HowToInstallScipyForQGis.pdf . It was written for QGIS 1.8, but should still work with newer QGIS versions.
- On MacOS you need to install the custom KyngChaos QGIS version including its python bindings. Numpy, Scipy and PIL can be found on the KyngChaos site as well and i advice user to follow the install intructions.
LecoS was tested under Linux Debian (Wheezy testing) and Windows XP (SP 3). If the necessary libraries are installed it should run out of the box for both QGIS 1.8 stable (Lisboa), QGIS 2.0 (Dufour) and QGIS dev. (Master).
Errors and Bugs:
If you stumble upon any errors PLEASE don’t report them in this blog as I really lose track of all those comments. Use the official bug-tracker to report any bugs while using LecoS and try to give me as much information about your system and QGIS setup (including package versions and maybe a small data subset for testing).
Martin Jung (2012) LecoS - A QGIS plugin to conduct landscape ecology statistics, http://plugins.qgis.org/plugins/LecoS
Current version: 1.9.8
I will continuously adapt and improve the QGIS-plugin in the future, if I have the time for it. Please reply below this post, if you have any ideas of improvement. Specific wishes can be implemented against a little donation.
See my blog posts below for more infos about the new versions
- Version 1.1
- Version 1.2
- Version 1.3
- Version 1.4 to 1.5.1 (Bugfixes and minor edits)
- Version 1.6
- Version 1.7
- Version 1.8 (Development Line Separation between QGIS 1.8 and QGIS dev.)
- Version 1.9
The development of recent versions of this plugin has been supported by the Universidade de Évora, Departamento de Biologia, Unidade de Biologia da Conservaçao.