inspired-postcodes / README.md
markmclaren's picture
Update README.md
50f178a verified
|
Raw
History Blame Contribute Delete
5.11 kB
---
license: other
license_name: open-government-licence-v3
license_link: https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/
tags:
- geospatial
- postcodes
- gb
- pmtiles
- vector-tiles
- inspire
- land-registry
pretty_name: Inspired Postcodes GB Postcode Boundaries (PMTiles)
---
# Inspired Postcodes
GB postcode boundary polygons derived from open Land Registry and ONS data, published as [PMTiles](https://protomaps.com/docs/pmtiles) vector tile files.
Interactive map: [markmclaren.github.io/inspired-postcodes](https://markmclaren.github.io/inspired-postcodes/)
The approach was inspired by Mark Longair's blog post:
[Open Data GB Postcode Unit Boundaries](https://longair.net/blog/2021/08/23/open-data-gb-postcode-unit-boundaries/)
Mark's Voronoi-processed postcode data, derived from Mapit, is also available as PMTiles:
[github.com/markmclaren/mapit-postcode-pmtiles](https://github.com/markmclaren/mapit-postcode-pmtiles) — [live viewer](https://markmclaren.github.io/mapit-postcode-pmtiles/)
---
## Files
| File | Layer name | Description |
|---|---|---|
| `inspire_original.pmtiles` | `inspire` | All INSPIRE property boundary polygons. Where a parcel spans multiple postcodes, it is split into segments using Voronoi cells seeded from UPRN coordinates. No-postcode parcels are retained. |
| `inspire_single_pcds.pmtiles` | `inspire` | Property parcels that map cleanly to exactly one postcode. Parcels with multiple or unresolved postcodes are excluded. |
| `inspire_dissolved_pcds.pmtiles` | `pcds_dissolved` | Postcode unit boundaries (e.g. `AB10 1AB`), formed by dissolving all single-postcode parcel geometries by postcode. |
| `inspire_sector_dissolved_pcds.pmtiles` | `pcds_sector_dissolved` | Postcode sector boundaries (e.g. `AB10 1`), formed by dissolving the unit boundaries. |
| `inspire_district_dissolved_pcds.pmtiles` | `pcds_district_dissolved` | Postcode district boundaries (e.g. `AB10`), formed by dissolving the sector boundaries. |
| `inspire_area_dissolved_pcds.pmtiles` | `pcds_area_dissolved` | Top-level postcode area boundaries (e.g. `AB`), formed by dissolving the district boundaries. |
All parcel-level layers (`inspire_original`, `inspire_single_pcds`) include the following properties:
| Property | Description |
|---|---|
| `pcds_single` | The single postcode assigned to the parcel (e.g. `AB10 1AB`). |
| `uprn_count` | Number of UPRNs within the parcel. |
| `pcds_count` | Number of distinct postcodes within the parcel. |
| `colour_index` | Integer (0–5) for neighbour-contrast polygon colouring. |
Dissolved layers include the postcode key for their level (`pcds`, `pcds_sector`, `pcds_district`, or `pcds_area`) plus `source_unit_count` and `source_polygon_count`.
---
## How the Data Was Produced
The pipeline was run on the [Isambard 3](https://docs.isambard.ac.uk/) HPC system using a set of Python/DuckDB scripts and Slurm job definitions.
1. **Download** INSPIRE GML zip files (one per local authority, ~318 councils for England and Wales) from the [HM Land Registry INSPIRE download service](https://use-land-property-data.service.gov.uk/datasets/inspire/download).
2. **Load** each GML into DuckDB via GDAL/`ST_Read`, with offline GML sanitisation to avoid remote schema fetches on HPC compute nodes.
3. **Enrich** polygons with postcode data by spatially joining NSUL UPRN points (converted from EPSG:27700 to WGS 84) onto each parcel.
4. **Split** multi-postcode parcels by constructing Voronoi cells from the UPRN point coordinates within each parcel and intersecting them with the original polygon.
5. **Export** to newline-delimited GeoJSON per council.
6. **Tile** each GeoJSON to MBTiles with [Tippecanoe](https://github.com/felt/tippecanoe) (zoom 0–16, geometry simplification, no tile size limit to prevent feature dropping at low zoom).
7. **Merge** all per-council MBTiles with `tile-join`, then convert to PMTiles with the `pmtiles convert` CLI.
8. **Dissolve** the single-postcode merged layer progressively by postcode unit, sector, district, and area (with a 2 m buffer to close small gaps between adjacent parcels before union), producing four dissolved PMTiles outputs.
---
## Data Sources
- **INSPIRE Index Polygons** — HM Land Registry Cadastral Parcel data for England and Wales.
[use-land-property-data.service.gov.uk/datasets/inspire](https://use-land-property-data.service.gov.uk/datasets/inspire/download)
- **National Statistics UPRN Lookup (NSUL)** — ONS dataset mapping Unique Property Reference Numbers (UPRNs) to postcodes and British National Grid coordinates (December 2025, Epoch 123).
[geoportal.statistics.gov.uk/datasets/4e0b4b3fbc2540caae27e7be532e61be](https://geoportal.statistics.gov.uk/datasets/4e0b4b3fbc2540caae27e7be532e61be/about)
---
## Licence
Contains HM Land Registry data © Crown copyright and database right 2025.
Contains National Statistics data © Crown copyright and database right 2025.
Licensed under the [Open Government Licence v3.0](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/).