Surface partitioning — Recipe (QGIS)
Tool-bound implementation of the Surface partitioning (Task) Schema, for GeoDanmark data. Uses the workshop scripts installed in Building heights from DHM (Recipe - QGIS). Used in Urban Design Visualisation (Example) (step 2).
GeoDanmark has road edges (Vejkant) and centre lines (Vejmidte), but no area polygons for roads, pavements, cycle paths or plazas. They are built in three steps.
A — Collect the edges
Hide Vejmidte (centre lines must not become boundaries) and keep Vejkant, the buildings and any other edge layers visible. Run Partition 1 - Build partition lines with your study area and snap tolerance 0.3 m. Save both outputs in 02_qgis/context.gpkg:
- Partition lines — all edges as one line layer, split where they cross. The field
src_layershows where each line came from. - Dangles — red points at loose line ends: the gaps that stop areas from closing.
B — Clean up by hand
Turn on snapping (Project → Snapping Options, vertex and segment, 1 m). Edit the partition lines:
- Close each gap at a dangle with a short line.
- Delete overshoots that stick out past a crossing.
- Draw the boundaries the data lacks, e.g. the edge between a plaza and the pavement, or the kerb of a planting bed.
C — Make polygons
Run Partition 2 - Polygonize partition lines:
- Input: the edited partition lines
- Buildings: the clipped building layer (polygons inside buildings become
building) - Centre lines: Vejmidte, and its road-type field as a hint
- Output:
02_qgis/context.gpkg, layersurfaces
If an area is missing, there is still a gap: check the Remaining dangles output, fix the lines, and run step C again.
D — Classify
Open the attribute table, use the hint column as a guide, and set surface from the drop-down (road, cycle path, footpath / pavement, plaza, parking, green, water, building, other). Unclassified polygons are outlined in red. Precision matters only in and around the square; the rest of the study area can be rough.
To save the drop-down and colours with the layer: Layer Properties → Style → Save as Default (stored in the GeoPackage).
Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
| An area is missing after Partition 2 | A gap in the partition lines | Look at the Remaining dangles points, close the gap with snapping on, run Partition 2 again |
| Road cut into many small pieces | Vejmidte was visible in Partition 1 | Hide centre lines and run Partition 1 again, or delete the centre lines from the partition layer |