October 2026 — Week 6 of 9

Applied Spatial Analysis Using QGIS - Raster Analysis & Demographic Planning

Applied Spatial Analysis Using QGIS — GIS for Surveyors (2026 Cohort) · 18 Oct 2026 · 39:39 · Watch on YouTube (offline-safe)

Do live (this session): reproject the DEM to UTM 36N → clip it to Red Sea state with Clip Raster by Mask → style it (pseudocolor + multiply blend) → derive Slope and Aspect → site criteria into a boolean raster with the Raster Calculator → raster to vector + area in the Field Calculator → railway 5 km buffer (dissolved) → Intersection → select the best sites > 150 acres.
Data: srtm_sudan.tif + hillshade, population_2020_1km.tif, admin2_districts.gpkg (UTM 36N)  |  Deliverable (graded): district_population.gpkg — districts with a population _sum column, taught live next session.

I write this after every live session — so students who lost power or signal can catch up in minutes, and so our community has a searchable archive for the future. Week 4 we asked questions of rows. Week 5, of space. This week we ask questions of surfaces — because a raster puts a value in every cell.

This week's two questions: "Where can we build?" and "How many people does this area serve?" — elevation under every square metre you might build on, population in every kilometre square you might serve.

Bilingual session. The first half (00:00–16:59) is taught in Arabic — the theory, the data sources, why rasters must be reprojected. The live demo from 17:00 is in English. The chapter list below marks the switch.

Why Week 6 Exists

Weeks 1–3 got your vector data on the map: imported, in metres, topologically clean. Weeks 4–5 taught you to ask it questions. Rasters are the other half of GIS — a grid where each cell holds a number, elevation or population or temperature. Continuous data lives here, and so do the questions surveyors answer with terrain and demographics.

The plan, live on screen:

  1. Recap the vector weeks, then open rasters — pixels, resolution, continuous data
  2. Where raster data comes from — imagery, sampling, interpolation, change detection
  3. Load the SRTM DEM and the Sudan population raster — and read a single pixel value
  4. Reproject the raster before analysis (exactly like we do with vectors)
  5. Clip raster by mask to a state boundary, then style the result
  6. Derive Slope and Aspect from the DEM
  7. Turn site criteria into a boolean raster with the Raster Calculator
  8. Hand it back to vector tools — raster to vector, Field Calculator for area
  9. Railway 5 km buffer → intersection → the best remaining sites

1) Raster vs Vector — Pixels and Resolution

A vector stores an object (a parcel, a road). A raster stores a grid of cells, each cell holding a number. Zoom in far enough on a raster and you see the truth: the pixel. Different cells carry different values; that is the whole idea.

Resolution decides how much detail you keep — a coarse cell is a summary of everything inside it, a fine cell is closer to the ground truth. Continuous data (elevation) and classified data both live in grids.

2) Our Data — DEM, Hillshade, Population

Two rasters carry the week:

We opened the population raster and clicked a cell: one value per pixel, the number of people living in that square kilometre. That single click is the whole concept behind "how many people does this district serve?" — you only need a tool that sums the pixels inside a boundary, which is exactly what next session's Zonal Statistics step does.

3) Reproject First

Rasters carry a CRS just like vectors, and the rule is the same: reproject before you measure. On screen: Raster → Projection → Reproject, target set to the project CRS (UTM 36N), output named ..._utm36n. After reprojecting we checked Layer Properties: the CRS is right, the units are metres, and the pixel size came out at 180 m × 180 m — coarse, but honest about the source data.

If you skip this step, every later measurement (slope, area, buffers) is measured in degrees pretending to be metres.

4) Clip Raster by Mask

The whole-Sudan DEM is heavy to render, so we cut it down: Raster → Extraction → Clip Raster by Mask, mask = the Red Sea state boundary polygon. Two settings matter and both were set on screen: the input is the raster, the mask is a polygon, and Keep resolution of input raster stays on so the pixel grid does not shift. The result was a small, fast layer that renders instantly — the same discipline as clipping vectors in Week 5.

5) Make the DEM Readable

A raw DEM renders as mud. Symbology → Singleband pseudocolor, a low-to-high colour ramp, min/max from the data, and multiply blending so the hillshade shows through underneath. We then copied the style into the saved project so next session starts with the same picture.

6) Slope and Aspect

Processing → Raster Analysis → Slope on the clipped DEM: percent, not degrees (the checkbox we ticked). Then Aspect — the compass direction each slope faces: 0 north, 90 east, 180 south, 270 west, closing back to 360.

Aspect is the tool that answers site questions a surveyor cares about: a solar field wants panels facing roughly 180–270; a glass facade wants the morning sun, not the evening one; and if you want to know why a road and a railway follow a particular valley, read the aspect and elevation either side of them.

7) Reading Cells and Terrain

Zooming into the raster shows the cells and their values; transparency on the DEM over the aspect layer lets you see both at once — blue is low, the bright edges are high, the valley is visible. This is the habit to build: look at the numbers before you trust the picture.

8) Site Criteria and the Raster Calculator

Now the analysis: pick the conditions, e.g. an aspect band (roughly 22.5–75 for a north-east facing site) and a gentle slope (under about 5%). The Raster Calculator takes both inputs and writes one expression with two conditions — the result is a boolean raster: 1 = meets both criteria, 0 = does not.

That is SQL thinking applied to a grid, and it is the same true/false logic you met in Week 4, now with a map as the answer.

9) Back to Vectors — Raster to Vector and Area

A boolean raster is only a grid, so we converted it: Raster to vector, which turns the 1 cells into polygons. Then the Field Calculator added the field that makes the result useful — area, in square metres and acres (an acre is a fixed multiple of m², so compute in metres first, convert second). Now the "suitable land" answer has a size attached to it.

10) Railway Buffer → Intersection → Best Sites

The last move reuses Week 5's tools on the new result: a 5 km buffer around the railway (run with dissolve: yes so the band is one zone, not overlapping rings), then Intersection between the suitable-land polygons and that corridor. Finally we selected the patches larger than 150 acres — four or five locations — and that is the answer to the siting question: raw raster data in, a shortlist of real sites out.

What We Did Live — Scrub Guide

Common Hang-ups and Fixes

  1. You set the CRS in Layer Properties and the raster still measures wrong: that only relabels the layer. Run Raster → Projection → Reproject and choose the target CRS — the pixels themselves must move.
  2. Clip Raster by Mask returns nothing or the wrong area: input = raster, mask = polygon, both in the same CRS, and Keep resolution of input raster switched on.
  3. The DEM renders as one flat colour: your min/max are not from the data. Set classification min/max from the layer, use singleband pseudocolor, and blend with the hillshade.
  4. Slope looks implausible: check the unit — degrees and percent differ by more than a factor of two on gentle ground. Tick the percent box if you want the engineering answer.
  5. Raster Calculator gives all zeros: the layer name in the expression must match the layer in the project, both inputs must share the same CRS and grid, and one of your conditions is probably written against the wrong layer.
  6. Your output raster vanished when you closed QGIS: it was a temporary result. Save it to a file when the tool asks — we hit save on screen for exactly this reason.
  7. The vector version of your suitability raster has no useful attributes: Raster to vector carries the grid value only. Add your own field with the Field Calculator and compute $area in metres first, then convert.
  8. The railway buffer looks like overlapping rings instead of a corridor: set dissolve to yes before running, otherwise the intersection counts the same ground twice.

What You Should Have Now

One note on the schedule, and why. We ran short, and I made a call: the population half of the mission — Zonal Statistics summing population_2020_1km.tif per district into district_population.gpkg with a _sum column — is taught live next session, ahead of Week 7's print layouts.

What you got today is the complete raster half: reproject, clip, style, slope, aspect, Raster Calculator, back to vectors, buffer, intersect, decide. Do Steps 1–3 of the Week-6 lab guide now; the deliverable is due after next Sunday's session, not before this one. The quiz for the week is already open (posted in the chat at the start of the session).

This is Project 4B. One quiz plus one practical lab — graded.

Chapters (from the recording — 39:39)

00:00  Welcome & this week's mission — the raster week
04:00  Rasters vs vectors: pixels, resolution, continuous data
06:10  Where raster data comes from — imagery, sampling, interpolation
08:05  Why rasters: change detection & multi-year comparison
10:05  Our data: SRTM DEM + population raster of Sudan
13:20  Reading a raster: one value per pixel (population demo)
15:15  Reproject rasters before analysis, exactly like vectors
17:00  Live demo: reproject the DEM to the project CRS (UTM 36N)
18:35  Clip raster by mask — cut the DEM to Red Sea state
19:30  Styling a DEM: singleband pseudocolor + multiply blend
21:20  Slope & Aspect from the DEM (Raster Analysis)
24:30  Reading cells, transparency & terrain on the map
26:35  Site criteria: which slope and aspect suit a site
29:12  Raster Calculator: aspect + slope conditions, boolean 1/0
31:55  Raster to vector & the Field Calculator (area in acres)
35:35  Railway 5 km buffer — intersection — best sites
39:00  Wrap up & what comes next

What's Next

Next session — the population raster: population_2020_1km.tif meets admin2_districts.gpkg through Zonal Statistics (Statistic: Sum), and the answer to "how many people live in each district?" lands as district_population.gpkg with a _sum column. Bring today's project — the DEM, the clip, the styling — because it is the same raster discipline, only the question changes.

Week 7 — Professional Print Layouts & Atlas (Project 5A): with the analysis answers in hand, we make them presentable — grid, scale bar, north arrow, legend, and QGIS Atlas generating one sheet per district at 300 DPI.

Resources: YouTube playlist Applied Spatial Analysis Using QGIS — Live Sessions & Labs · Video: Week 6 on YouTube · Course site saltco.org · Software QGIS (free & open source, offline) · Previous: Week 5 — Spatial Proximity & Multi-Criteria Analysis · Full publish kit in recordings/zoom_recordings/06_WEEK6/

Did I miss something? Tell me in the Q&A or open an issue — this archive is living and I will update it. — Sallah