Introducing the Landscape modifier to LecoS


i just pushed a new update to my QGis-plugin LecoS called the “Landscape Modifier“. At first it sounds strange by name, but i believe that it can be really useful even in cases that don’t involve any ecological expertise. In fact the desire to add these functions has been one of many reasons i even started coding this plugin. I am fascinated by the possibilities the scientific python library Scipy and also scikits offers in matters of image analysis. With just a few lines of code one could easily filter, denoise and improve images as demonstrated on this very good tutorial site. This can be useful in GIS-applications as well as raster layers are in fact very similar to image files. In essence both consist of multiple rows and columns containing data values. So moving from images to raster layers in GIS-systems isn’t so hard at all. But now about the plugin update.

I added the following functions:

  • Extract Landscape patch edges (Returns a raster with only the outer borders of raster patches)
  • Isolate greatest/smallest patch (Returns only the smallest or biggest patches of landscape class)
  • Increase or decrease landscape patches (Returns a raster with landscape patches inc./dec. x times)
  • Fill Holes inside landscape patches (Closes inner holes of landscape patches)
  • Cleans landscape of small border pixels (Removes all pixels smaller than x times a taxicab structure)



Here is a practical use-case. I performed a supervised landscape classification using training polygons to extract tree cover from a study location in western Africa. There are a lot of errors, small pixels and holes in the woodland and i will try to improve that a little. My previous landscape classification looks like this:

Extracted and classified tree cover

Extracted and classified tree cover

After executing “Fill holes“, a “small pixel cleanup” and an “increase” of all woodland pictures the result looks like the picture below. Of course the question if one should perform those operations should always be cleared first. Think about your classification critically and if it can be improved. In my case i only wanted the major trees and i am not interested in any artifacts or smaller shrubs.

Looks after cleanup.

Looks after cleanup. Ready to polygonize or process in LecoS to get the amount of tree cover.

Download the new update via the QGis plugin downloader or here. Please contact me only in case you found a bug and not about operating system specific questions (like how do i install scipy). I probably won’t answer to those question anymore!

The next mayor milestone for LecoS will probably be SEXTANTE toolbox support ! Furthermore i would really want to see a plugin using all the various available scipy.ndimage functions. I believe that it is just a matter of time before such a plugin shows up. Many of the various methods could really be useful in QGis, for example for DEM smoothing as demonstrated in this or this gis.stackexchange answers.


Tags: , , , , ,

About Martin Jung

PhD researcher at the University of Sussex. Interested in nature conservation, ecology and biodiversity as well as statistics, GIS and 'big data'

2 responses to “Introducing the Landscape modifier to LecoS”

  1. Vania Neves says :

    Very nice! very good job. May I ask you what tools/protocol did you used for the supervised classification with training areas? Thanks in advance. Cheers!

    • Curlew says :

      Hey Vania, thanks! In particular i first created multiple training polygons (each with a unique id) for trees and savanna terrain. Then i used my satellite images and did a supervised Classification using SAGA via the SEXTANTE toolbox in QGis (SAGA function -> Imagery Classification -> Supervised Classification). I calculated this on normalized mahalanobis distances with a distance threshold of 10. But i believe this method only worked out so well on my dataset because there is quite a color contrast between savanna terrain (earth colored) and trees (darkgreen). If you want to classify like 4 or more different classes than you probably have to do more clean_up, pre- and postprocessing work. Search the net how to do this

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"

Trust Me, I'm a Geographer

Using Technology to Explore Our World

Duncan Golicher's weblog

Research, scripts and life in Chiapas

%d bloggers like this: