Products QGIS Scripts CHM Height Band Classifier
CHM Height Band Classifier

QGIS Script · Python

CHM Height Band Classifier

Applies 8 classified height bands to a CHM raster and exports a static JPEG map with legend, north arrow, and scale bar built in — ready for client reports without opening Layout Designer.

$20 USD One-time purchase · Instant download
Buy on Gumroad

What you get

style_chm.py
Free updates via Gumroad

What it does

8 classified height bands

Groups CHM pixels from 0–1 m bare ground through 1–3 m, 3–8 m, 8–15 m, 15–20 m, 20–25 m, 25–30 m, and 30 m+, each in a distinct colour.

Static map JPEG export

Exports a flat JPEG image with a legend panel, north arrow, and scale bar built in — ready to drop into a report without Layout Designer.

Classified GeoTIFF output

A georeferenced classified raster is saved alongside the JPEG and loaded into the QGIS project for further analysis or styling.

Customisable height bins

The HEIGHT_BINS list inside the script can be edited to match the typical canopy heights in your study area.

How to use it

  1. 1

    Generate a CHM with generate_chm.py or load an existing CHM raster.

  2. 2

    Check (tick) the CHM raster in the Layers panel. Layer name must contain chm.

  3. 3

    Open Plugins → Python Console → Show Editor.

  4. 4

    Paste the script and click Run.

Requirements

  • QGIS 3.28 or newer
  • numpy, rasterio, matplotlib — rasterio/numpy bundled; matplotlib may need OSGeo4W install
  • CHM raster — layer name contains "chm"

Also in the Terrain Analysis Pack

Get all 6 terrain scripts for $35 — save $15 vs buying individually.

View bundle