LecoS – Land cover statistics
I proudly present my first own QGIS-plugin. I had funny and bad times coding this piece of software. I hope it will prove useful to some open source GIS users out there. If not, then at least i learned a lot about coding plugins and landscape metrics. Please notice that this piece of software is still experimental and the author takes no responsibility for bugs or miscalculations.
LecoS – Land cover statistics is a plugin for the QGIS GIS software suite. 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.
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
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 don’t 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-imaging) or compile them system wide. 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).
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) 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).
Current version: 1.7.3
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.
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
The development of recent versions of this plugin has been supported by the University of Évora and future version will include the options to analyze landscape vector layers, additional metrics and post-hoc result grouping.