QGIS Script · Python
Survey Grid Generator
Creates a regular rectangular grid of equal-sized cells clipped to your polygon boundary. Set one parameter — cell size in metres — and the script handles CRS, clipping, and export to GeoJSON. Loaded into the QGIS project immediately.
What you get
grid_generation.pyWhat it does
Equal-sized rectangular cells
Generates a regular grid where every cell is the same width and height in metres — useful for systematic sampling or inspection zones.
Clip to polygon boundary
If polygon layers are checked, the grid is clipped to their combined shape. Only cells inside the boundary are retained.
Auto UTM reprojection
Detects geographic CRS (degrees) and automatically reprojects to the appropriate UTM zone so your cell size setting is in real metres, not decimal degrees.
Canvas extent fallback
If no polygon layers are checked, the grid covers the current canvas extent — useful for creating reference grids without a specific boundary.
How to use it
- 1
Load your boundary polygon layer and check (tick) it in the Layers panel.
- 2
Open Plugins → Python Console → Show Editor.
- 3
Paste the script. At the bottom, set
cell_size_min metres (e.g.50for a 50×50 m grid). - 4
Click Run.
Requirements
- QGIS 3.28 or newer
- QGIS processing framework — bundled
- (Optional) polygon GeoJSON layers to clip the grid
Also in the GIS Utilities Pack
Get all 4 GIS utility scripts for $25 — save $5 vs buying individually.