Network gaps and stepping stones — Recipe (QGIS)
Tool-bound implementation of the Network gaps and stepping stones (Task) Task Schema in QGIS 4.2. Worked example: Habitat network at Ledreborg (Example).
Data you need
| Role | Form | Level of measurement | Notes |
|---|---|---|---|
| Patches with cluster | polygons | nominal cluster_id | from Habitat network (Task) |
| Land where new habitat is possible | polygons, or a raster to convert | nominal land-use classes | e.g. farmland classes of a land-cover raster |
| Excluded land (optional) | polygons | nominal | roads, buildings: negative constraints |
| Strip width, minimum cluster size | numbers | ratio | from the Task’s choices |
Each cluster’s own habitat (Task Schema steps 1–2)
- Dissolve (Tool - QGIS) on the patches, Dissolve field(s)
cluster_id: each cluster’s habitat without the buffer, so gaps are measured between real patches. - Extract by expression (Tool - QGIS) twice:
- the main network:
"cluster_id" = <id of the largest>(sort the attribute table by$areato find it) - the clusters to connect:
"cluster_id" <> <id of the largest> AND $area >= <minimum m²>
- the main network:
Shortest connections (step 3)
Shortest line between features (Tool - QGIS): Source layer the clusters to connect, Destination layer the main network, Method Distance to Nearest Point on feature, Maximum number of neighbors 1.
Proposed new habitat (steps 4–6)
- Buffer (Tool - QGIS) on the lines: Distance = half the strip width, End cap style Flat, Dissolve result ticked.
- If the possible land is a raster: Reclassify by table with the possible classes → 1 (Use no data when no range matches), then Polygonize (raster to vector).
- Clip (Tool - QGIS): the strip, with the possible land as Overlay layer (positive constraint).
- Difference (Tool - QGIS): the result minus the habitat patches and any excluded land (negative constraints).
- Sum the lengths of the lines and the area of the new habitat with the statistics panel.
Checked in QGIS 4.2.2, October 2026.