QGIS Script Bundle · 6 Scripts
Terrain Analysis Pack
Six Python scripts for QGIS covering the full terrain analysis workflow for drone survey outputs — coloured hillshade generation, Canopy Height Models, smooth contour lines, flood-level polygon mapping, and lake volume calculation.
Built for drone surveyors who need to go from raw DTM/DSM rasters to client-ready terrain deliverables without manual renderer tweaking. Every script is self-contained, runs in the QGIS Python Console, and adds its output to the project automatically.
What you get
generate_hillshade.py generate_chm.py style_chm.py generate_contours.py generate_contour_level_polygon.py calculate_lake_volume.py What the pack covers
Canopy Height Model
DSM minus DTM gives height above ground at every pixel. Auto-resamples when DSM and DTM have different resolutions.
Classified height map
8 height bands from bare ground to tall canopy, with static JPEG export including legend, scale bar, and north arrow — ready for client reports.
Smooth contour lines
Gaussian smoothing removes the triangular mesh artefact from drone DTMs. Chaikin's algorithm rounds the contour lines for clean, cartographic-quality output.
Flood / water-level polygons
Set a target elevation and the script returns filled polygons of every area below that level — ideal for reservoir extent modelling or flood mapping.
Lake / crater volume
Reports cubic metres, litres, and acre-feet. Also exports a depth raster showing how deep each pixel is relative to the reference water surface.
Auto-loads in QGIS
Every script adds its output layer to the QGIS project immediately — no manual drag-and-drop. Each has a built-in HOW TO USE reference block.
Scripts in this pack
generate_hillshade.py Coloured Hillshade
Generates a publication-ready viridis hillshade from any DTM or DSM. Multidirectional shading removes blind valleys. Auto-downsamples large files. Smart normalisation handles both flat and varied terrain. Outputs RGBA GeoTIFF and a JPEG.
generate_chm.py Canopy Height Model
Subtracts DTM from DSM to produce a height-above-ground raster. Handles resolution mismatches by auto-resampling. Negative artefacts clamped to zero.
style_chm.py CHM Height Classification
Applies 8 classified height bands to a CHM raster (0–1 m bare ground through 25 m+ canopy). Exports a static JPEG with legend, north arrow, and scale bar.
generate_contours.py Smooth Contour Lines
Gaussian-smoothes the DTM to remove drone mesh artefacts, generates contour lines, then smooths lines with Chaikin's algorithm. Major contours labelled with elevation in metres.
generate_contour_level_polygon.py Water-Level Fill Polygons
Finds every DTM pixel at or below a target elevation and converts them into filled GeoJSON polygons. Useful for flood-level visualisation or identifying low-lying areas.
calculate_lake_volume.py Lake / Crater Volume
Computes water storage volume of a lake or crater by comparing DTM elevations inside a boundary polygon against a reference surface derived from the polygon edge. Reports cubic metres, litres, and acre-feet.
Who it's for
- Drone survey professionals processing DTM/DSM outputs from WebODM, photogrammetry software, or point cloud pipelines
- GIS analysts who need clean terrain deliverables (contour maps, height models) without manual rendering
- Engineers or hydrologists needing reservoir volume or flood extent from drone survey data
Requirements
How to use it
- 1
Load your DTM and/or DSM rasters into QGIS and check (tick) them in the Layers panel.
- 2
For lake volume: select your boundary polygon layer as the active layer in the Layers panel.
- 3
Open Plugins → Python Console → Show Editor.
- 4
Open the script you need — each has a
HOW TO USEblock at the top with exact input instructions. - 5
Adjust parameters at the bottom of the script (elevation threshold, contour interval, etc.).
- 6
Click Run — all outputs are generated and added to your QGIS project automatically.
Built-in instructions in every script
Each script has a HOW TO USE block at the top
that documents the active layer, checked layers, output, log path, and configurable parameters — so you
always have the reference without needing to open external documentation.
Get the Terrain Analysis Pack
Six scripts, one download. From raw DTM/DSM to client-ready terrain deliverables in minutes.