I was wondering if someone has delt with this kind of issue before:

I want to delineate fragments based on neighboring pixels of the same class (forest) with a distance threshold of 3 pixels (which is biologically significant for my specie of interest).

My concern is, see the attached image for an example, that sometimes these fragments are actually corridors, and often corridors and actual fragments are grouped into a same fragment because of their proximity.

enter image description here

I'm wondering if there is a way to distinguish the corridors from the fragments based on shape, number of surrounding pixels, etc..?

For instance, in the following box, possible corridors are indicated by the red boxes, and fragments by the green ones.

I have access to QGIS and R.

enter image description here

  • could you please add a figure with the type of corridors that you would like to extract from the example ?
    – radouxju
    Apr 23, 2018 at 12:54

3 Answers 3


It's not a full solution but, check out these tools for connectivity analysis (the first approximates well what you are searching):

Also consider training a machine learning algorithm to classify your instances (corridor vs. fragments). You can give spatial attributes at patch level (e.g., patch size, perimeter area-ratio, circle ratio) and distance-based features (e.g., distance to fragments) to classify. For calculating the patch-level features needed for classification you can try FragStats (https://www.umass.edu/landeco/research/fragstats/fragstats.html).

You can also consider a simpler 'expert-based rule system' to classify each instance. For example, corridors will have higher perimeter-area ratio than habitat fragments and so on..

More interesting stuff here for connectivity analyses: http://conservationcorridor.org/corridor-toolbox/programs-and-tools/

However, the fact that some corridors don't have 'full pixel connectivity' will be an issue that you need to sort out first. I think that you have to define some kind of a distance-based threshold criteria to decide if some pixel is part of a corridor or not.


Before starting any analysis, I would highly recommend applying a filter to your data to clean up the "salt and pepper" effect. Any algorithm will struggle with the current structural pattern of your data. A simple focal majority would likely yield undesirable results. A more robust method is applying a sieve approach, where a minimal-mapping-unit can be specified. This can be done via the gdal_sieve.py function in GDAL, the raster > analysis > sieve function in QGIS or the sieve function in the ArcGIS Gradient Metrics Toolbox.

This looks like something that could be addressed with Mathematical Morphology operators (eg., extracting roads from imagery). I would imagine that a dilation operator followed by a Closing operator would clarify the corridors. You could then apply an Opening operator, to remove the corridors, and difference the rasters to pull the identified corridors as separate objects. These types of image decomposition functions are somewhat automated in the MSPA and GUIDOS software but, once again, would be notably effected by the discontinuities in your data.

There is a QGIS plug-in for MSPA as well as available functions in GRASS (available through the QGIS GUI). One of the issues with MSPA and GUIDOS is that you are limited in the image size. Unfortunately, in ESRI software, morphological operators are only available in the ArcScan extension. With some digging you will find other software options as well as methods for defining morphological operators through raster algebra with custom kernel matrices.

Another approach would be edge detection filtering methods such as a Sobal kernel operator. There is a sobal function in the ArcGIS Gradient Metrics Toolbox as well as in the spatialEco R package. The advantage of the R implementation is that you can return the gradient function of the operator whereas the ArcGIS implementation only returns the 1`st order function (which may be all you need). I believe that the Orfeo toolbox (available as a QGIS add-on) has a sobal option in the EdgeExtraction function.

  • perhaps applying a "salter and pepper" filter may have the effect of removing small important habitat areas for the target species connecting fragments (although sometimes sub-optimal quality areas). I would decide applying such a filter based on the dispersal characteristics of the species and the spatial resolution of the data. A bird (with generally higher dispersal ability) may use those small patches while an amphibian (with comparably lower dispersal ability) may not. Just a thought..
    – Kamo
    Apr 23, 2018 at 16:33
  • This is always a trade off but the minimal mapping unit should account for this given hypothesis. But, you also have to keep in mind that the balance is that the model exhibits a certain degree of uncertainty and you are treating the result as an absolute. Honestly, to support your assertion, the landscape should be treated as a probabilistic gradient and not a binomial process. This type of filtering is a long accepted practice in representing more functional landscapes. Unless the model included a term accounting for spatial structure in the estimates, spatial uncertainly is a reality. Apr 23, 2018 at 16:55

It seems that it depends on the shape of your fragment. If the width is more than 2 (or 3) times the height (or the opposite), you may call it a corridor?

Have you come to the delimitation of the fragments yet?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.