I'm trying to calculate some sort of forest connectivity value for each pixel in my land cover classification. I would like to do this by calculating how many other forest pixels are directly connected (no gaps) to each forest pixel in the data. Is there a tool or approach for this?

What other means of calculating forest connectivity you would suggest?

  • 2
    What software do you work with? – Aaron May 8 '15 at 11:47
  • 1
    One focal stats operation would make short work of this. For instance, a 3 x 3 neighborhood sum of the forest pixel indicator raster will count all such pixels (including the central one). Optionally subtract 1 to compensate for the central pixel. Mask the result to the forest pixels. Additional local-neighborhood morphological operations are available in most raster GISes. Almost all connectivity calculations are carried out using some combination of more basic focal and morphological operations. – whuber May 8 '15 at 16:03
  • I have already done some kernel density calculations for the data, which I see similar, but more interesting than focal statistic. The problem is however, that these approaches doesn't acknowledge the morphological connection between pixels. Eventually, I would like to combine my kernel density calculations with the morphological data. – Markus Kukkonen May 9 '15 at 3:16

Since you are analyzing a binary landscape matrix for connectivity, there is a very robust model available. I would direct you to the Guidos toolbox software, which is an implementation of the "Morphological Spatial Pattern Analysis model" (Vogt et al., 2007). This model uses mathematical morphology to decompose a series of scales to assess core habitat and connectivity. The software also has a graph theoretical model available to quantify connectivity based on the results provided by MSPA.

We have an implementation of the MSPA model in an ArcGis Toolbox that we are releasing soon. Let me know if you would like the Python code or a pre-release of the toolbox.


Vogt, P. K.H. Riitters, C. Estreguil, J. Kozak, T.G. Wade, J.D. Wickham (2007) Mapping spatial patterns with morphological image processing. Landscape Ecology, 22:171–177

| improve this answer | |
  • This Guidos toolbox looks exactly what I was looking for. It should also allow defining edge width, which makes it even more interesting. Do you know have they somehow tried to combine these morphological calculations with kernel density to create other connectivity measures? – Markus Kukkonen May 9 '15 at 3:19
  • Also I would be highly interested on Python code or a pre-release of the toolbox. Maybe the pre-release slightly more as my time is bit scarce at the moment. – Markus Kukkonen May 9 '15 at 3:20

The most simple method I can think of is to create regions of adjacent polygons, count the number of pixels per regions, then assign this value (minus 1) to each pixel of the region (each pixel of the region is directly connected to all other pixels). Depending on the software that you use, the implementation could vary, but the following steps are available in most softwares:

1) convert your raster to polygon

2) compute the area of the polygons, divide by the area of one pixel, remove 1 from the result

3) convert the polygon to raster using the field that you've just created

| improve this answer | |
  • This is a global statistic that doesn't really measure "connectivity." If you really want to count pixels per connected regions, just use a zonal count based on RegionGroup output--it avoids those unnecessary conversion steps. – whuber May 8 '15 at 16:03

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.