Distance to habitat — Recipe (QGIS)

Tool-bound implementation of the Distance to habitat (Task) Task Schema in QGIS 4.2. Worked example: Habitat network at Ledreborg (Example).

Data you need

RoleFormLevel of measurementNotes
Habitat patchespolygons— (presence)e.g. from Nature content layer (Task), covering the study area plus a margin
Zones (optional)polygonsnominalfor summaries, e.g. landscapes
Distance (output)rasterratio (metres)

A projected CRS in metres (EPSG:25832 for Danish data).

Rasterize the habitat (Task Schema steps 2–3)

Rasterize (Tool - QGIS) on the patches:

  • A fixed value to burn: 1; Pre-initialize the output image with value: 0
  • Output raster size units: Georeferenced units; width and height = the chosen cell size
  • Output extent: the study area plus its margin
  • Additional command-line parameters: -at (all touched), so features narrower than a cell are not lost

Compute distances (step 4)

Proximity (Tool - QGIS): A list of pixel values to use as target 1, Distance units Georeferenced coordinates, Output data type Float32.

Cut to the study area and summarise (steps 5–6)

  1. Clip raster by extent (Raster extraction) to the study area.
  2. Style it with Singleband pseudocolor, mode Discrete, with classes from the question (e.g. 50, 100, 200 m).
  3. Per zone: Dissolve the zones by their type field if several polygons share a type, then Zonal statistics (Tool - QGIS) with Mean and Max.

Checked in QGIS 4.2.2, October 2026.