Friday, January 26, 2024

Exciting facts about UK postcodes

I have some exciting facts about UK postcodes and I'm going to post them here. My data source is the ONS Postcode Directory (ONSPD) and I'm sharing this information here because it's all incredibly interesting and you know it. If you have a list of UK postcodes that you just want to turn into lat/long or eastings/northings then Doogal's batch geocoding tool is what you need. He really is a hero. But anyway, back to the boring stuff.

Okay, let's start with postcode extremes by latitude and longitude - here's a map of that.

Well, now we know

What about longest straight line distance between UK postcodes? It would appear to be ZE2 9EQ in the north of Shetland to TR22 0PL in the Isles of Scilly.

Currently £1.25 to send a letter first class

In the ONSPD file I used, downloaded in January 2024, there are 2,697,530 postcodes - and by that I mean there is a point for each full postcode unit in the UK with a geographic location - e.g. NW1 1AA. But hold on a second, this is way more than the actual number of UK postcodes so what's going on? 

Red Road flats, Glasgow (CC, Miles Glendinning)

The ONSPD file also contains postcodes that are no longer active - for example for areas where lots of buildings have been demolished like in the case of the old Red Road flats in Balornock / Barmulloch in Glasgow, and lots of other examples across the UK. They are still in the file but you can easily filter them out using the DOTERM column (this column indicates when a postcode was terminated):

"If present, the most recent occurrence of the postcode’s date of termination, otherwise: null = ‘live’ postcode"

That's the kind of useful information you can find in the user guide.

Postcodes that are no longer in use

What about postcodes with no geographic location? Well there are about 24,000 of those in the dataset and they don't have a point but that's a bit of a pointless thing to say, isn't it?


How many live, in-use postcodes are there? 

In the ONSPD dataset I'm using here, there are 1,798,027 live postcodes in the UK. And the geographic centre of all of these? Well it happens to fall just to the north east of Barton-under-Needwood in Staffordshire. So now we know that too.

Barton-under-Needed to know this

Should be the capital of the UK, clearly

Other stuff

What about postcodes with an i in them? See below.

There are some IM postcodes in there, but no dots

I quite like the way the Kirkwall postcodes look like they're invading Caithness.



Can't you do some point-in-polygon postcode density maps?

Yes I can. I can do it with squares. Or I can do it with other shapes. This is definitely not pointless because there are more than 1.7 million points so how can it be?

Postcode density by 10km square


5km hexagons, shaded by postcode count (yellow = more)


That's enough of that.