Consultancy HomeAll Exercises02 GeoPackage03 HandoverEducators
Exercise 01 · Spatial Statistics in QGIS 4

Which Cell Is the REAL Hotspot?

Compare raw counts against inclusive Getis–Ord Gi* local clusters on a 12 × 12 survey grid—using a free, zero-dependency QGIS 4 Processing Toolbox script you can reuse on your own polygon layers.

⬇ Download Exercise ZIP (Project + Universal Script) ▶ Companion Video Walkthrough ↗
Verification & Assignment Spec
15–20 minsTested: QGIS 4.0.0Zero external Python librariesEPSG:27700CC BY 4.0

Objectives: Separate isolated outliers from significant clusters · Retain genuine observed zero cells · Run Bonferroni-adjusted Getis–Ord Gi* · Test sensitivity to neighbourhood scale (1 ring vs 2 rings).

Step 1 · Inspect the Input & Observed Zeros

  1. Unzip the archive, keep AMDGS-grid.qgz beside survey.gpkg, and open the project in QGIS 4.
  2. Open the attribute table for Survey counts and sort reports descending. Locate I09 (18 reports) and D04 (9 reports).
  3. Run Select by Expression with "reports" = 0 to inspect the 42 genuine observed zeros across the equal-effort grid, then clear the selection.

Step 2 · Run the Universal QGIS 4 Processing Script

  1. Open Processing Toolbox → click the Python Scripts toolbar icon → Add Script to Toolbox… and select amdgs_getis_ord_gi_star.py.
  2. Run Scripts → AMDGS Spatial Analysis → AMDGS Getis-Ord Gi* Hotspots with Input = Survey counts, Field = reports, Neighbourhood = Queen contiguity — 1 ring, Permutations = 9999, Correction = Bonferroni, Seed = 20261119.
  3. Filter the output by "is_hot" = 1 to isolate the 5 flagged hotspot squares, then compare I09 and D04.

Step 3 · Scale Sensitivity Check (1 Ring → 2 Rings)

Re-run changing only Neighbourhood from 1 ring to 2 rings and inspect boundary cell C03.

Check your numbers against the verified reference table
CellOwn reports1-ring sum1-ring p_high1-ring flag2-ring sum2-ring flag
I0918180.3147No27No
D049720.0001Yes97Yes
C037420.0020No97Yes

Totals: 144 polygons · 245 reports · 42 zeros · 5 flagged hotspots at 1 ring · 9 flagged hotspots at 2 rings.

Applying the Tool to Your Own Data

Next: Exercise 02 (GeoPackage) → Back to Exercise Library