Things to do with leaked postcode data

An interesting file turned up on Wikileaks yesterday:

UK government database of all 1,841,177 UK postcodes together with latitude and longitude, grid references, county, district, ward, NHS codes and regions, Ordnance Survey reference, and date of introduction. The database was last updated on July 8, 2009 and is over 100,000 pages in size.

Something that I thought might be interesting is to see how postcodes are distributed within an area. I took all the postcodes from my local area (SE16), put them in alphanumerical order (1AA, 1AB, ..., 1ZZ, 2AA, ... etc.) and used JavaScript and the canvas element supported by newer browsers to visualise them.

They’re plotted on a (colour-blindness-friendly) colour continuum from blue to yellow, with a short delay between each. This results in something like this:

SE16 postcodes visualised

It’s interesting to see that postcodes are allocated roughly in a clockwise spiral out from the centre. The reason why they are all in a slightly skewed grid is, I think, a result of the latitude/longitude being translated from OS grid references.

You can watch the animation here if your browser supports it. Safari, Firefox, Opera should be fine. Internet Explorer need not apply.


  1. Shot (Piotr Szotkowski)

    Wrote at 2009-09-17 14:13 UTC using Mozilla on Linux:

    First, it’s absurd that this info is not public in the first place…

    Second, the clockwise-spiral-from-the-centre approach is also used in Polish postcodes, so there might be some benefits to this approach to area ordering.
  2. David

    Wrote at 2009-09-17 19:22 UTC using Firefox 3.5.3 on Windows XP:

    There appears to be an overlap of one or two of the blobs* – is that a rendering issue or are the postcodes actually the same?

    * The most obvious one is the diagonal line “backslash” of 3 blue blobs in the top right – focus on the middle one and watch it “become” yellow…
  3. Paul Battley

    Wrote at 2009-09-17 19:28 UTC using Mozilla on Linux:

    I think the geolocation information in the file just isn’t very accurate. The co-ordinates are given using OS grid references, but they are all rounded to the nearest 10. This means that different locations end up rounded to the same co-ordinates.

    The lat/long pairs (also in the same file) that I used are obviously derived from the grid references, so they’re never any more accurate than what you see here.
  4. Andrew Forrest

    Wrote at 2009-09-19 19:17 UTC using Chrome on Mac OS X:

    It’s unjust and stupid that this data, compiled at the public’s expense, is not made available to the public.

    It also leads to absurd situations, like the Royal Mail on the one hand wanting people to write post-codes on letters and parcels, and on the other, their website restricting the number of postcodes you are allowed to look up, and hiding them behind a captcha.
  5. Peter Grosse

    Wrote at 2009-09-27 18:48 UTC using Firefox 3.0.14 on Linux:

    I’d do this if I had the know-how, and know this is probably a bit rude, but could I ask you to put together a bnp list style spreadsheet with a script or something?

    Thanks in advanced if possible.
  6. Paul Battley

    Wrote at 2009-09-27 19:02 UTC using Mozilla on Linux:

    Peter: uh, what?
  7. Peter Grosse

    Wrote at 2009-10-01 18:15 UTC using Firefox 3.0.14 on Linux:

    I think I was a bit tired/out of it when I wrote that – sorry, forget it.
  8. Avo

    Wrote at 2009-10-16 12:13 UTC using Firefox 3.0.14 on Linux:

    Wo! How fab!
    I’ve always wanted to see how that would look. Thanks for showing it.

    Going to have a lurk around your site now…


  9. steveydoteu

    Wrote at 2010-01-21 12:52 UTC using Firefox 3.5.7 on Windows Vista:

    Just finished playing around with the script on my Debian machine.

    Thanks for your guidance, I must say it has been one of the more interesting ways of trying to learn to use Ruby.