QGIS Script · Python
Layer Colour Classifier
Applies a yellow → green graduated colour style to any numeric attribute on a vector layer — instantly turning a table of numbers into a visual health or ranking map. A common use is styling the NDVI_median output from the Canopy NDVI Calculator to colour-code tree crowns from stressed (yellow) to healthy (green). It is a separate script sold individually or as part of the GIS Utilities Pack.
What you get
classify_layer.pyWhat it does
Yellow → green gradient
Applies a clear low-to-high colour ramp using the yellow-green palette — immediately legible for any ranking or continuous value field.
Discrete or percentile
"discrete" divides the full range into 0.1-width equal steps — best for 0–1 fields like NDVI. "percentile" divides by data distribution into four quartiles — better for height or any wider-range field.
In-place style update
The style is applied to the layer renderer directly — no new file is created. The change is visible immediately in the QGIS canvas.
Any numeric field
Change the column name at the bottom of the script to classify any numeric attribute — NDVI, height, area, score, or custom field.
Works great after: Canopy NDVI Calculator or Tree Height Extractor
Both the Canopy NDVI Calculator and the Tree Height Extractor output a GeoJSON with a numeric field per feature (NDVI_median or height) but no visual style. Run this script on either output to immediately colour-code features from yellow (lowest) to green (highest).
How to use it
- 1
Load your vector layer and check (tick) it in the Layers panel.
- 2
Open Plugins → Python Console → Show Editor.
- 3
Paste the script. At the bottom, set
column(the field name to classify) andmethod("discrete"or"percentile"). - 4
Click Run. The layer style updates immediately.
Requirements
- QGIS 3.28 or newer
- First checked vector layer with a numeric attribute field
- numpy — required for percentile mode (bundled with most QGIS installations)
Also in the GIS Utilities Pack
Get all 4 GIS utility scripts for $49 — save $29 vs buying individually.