Mapping UK postal districts to regions
Dull, but really quite useful
I was recently preparing a report that had to summarise data for around 2,000 UK postcodes by national region. Figuring out which postcodes go where was a stickier problem than it first looked, so I'm popping our solution up here in the hope it helps someone else.
We'd decided to use European Electoral Regions (the irony isn't lost on me!) for our report's regional summary mostly because EER's sound big and familiar: London, North West, Scotland, etc.
You can use the "National Statistics Postcode Lookup" file available from the ONS open geography portal to map postcodes to equivalent EERs, but that's where it gets a little sticky.
UK geographies aren't terribly hierarchical and postcodes don't fit neatly into government statistical boundaries. NSPL maps individual postcodes to EERs, but we needed to group by postal districts e.g. SW19.
Most postal districts are easy e.g. all BA1 postcodes (central Bath) are listed within the South West region.
But many districts span multiple regions e.g. KT4 has most of its postcodes in London, but also a lot in the South East.
Which region should we put it in?
The solution was to assign a "dominant region" to each district. Since most of KT4's postcodes are in London, KT4 appears in the London section of the report.
Linking regions with postal districts
This lookup table is what we boiled down from the full NSPL file, and it splits the country's postcodes neatly into regions. We couldn't find anything similar elsewhere, so I'm posting it freely here for anyone else who runs into the same issue.
It seemed like a neat little problem to solve.
uk-postal-districts-eer.csv (81Kb file, 3102 postal districts)