Wednesday, 3 June 2015

New postcode layer

I've just finished extracting the data from a full download of OS Open Names and setting up a layer to see the new postcodes. The postcode data is only a centroid for each postcode area.

I maintain a layer of postcodes from the Office of National Statistics, one from Codepoint Open and now Open Names. The Codepoint Open and ONS postcodes are in the same locations, though Codepoint Open data is a bit more up-to-date right now. The OS Open Names postcode locations are now sub-metre, so I expected that the centroid might be in a slightly different location, but some are substantially different as you can see here.
 The Codepoint Open are in red, the OS Open Names are in magenta.

I don't store any of these tiles, I render them on the fly. Real tiles are often stored in a hierarchy of folders in the form of
Since I don't store any of these, when someone requests a tile they would normally get a "Not found (404)" error. I trap these errors and use the folder hierarchy to extract the postcode centroids from a database for the zoom, x and y area of the tile.  This is used to render a tile with a transparent background and centroid markers on it. I do this because I didn't want to use the considerable disk space the real tiles would take up, especially as I create to to zoom level 21 to make editing easier with the layer switched on.

I also extracted the road name and place name data, reprojected all of the location data from OS grid references to lon and lat and stored them for later use. If anyone wants to see this I'll happily pass it on, just ask.

If you want to see the new postcodes you can see the new layer on oscompare. Make sure you open the layer selection (blue+white +) and select what you want to see. You need to zoom in to see the postcodes.


Jeremy said...

That's really interesting - thank you for doing this!

IIRC CodePoint postcodes are fixed to a building. The OS Open Names postcodes aren't, which is fine if the road is straight; for a street with the same postcode on both sides the centroids seem to be closer to, or on the highway itself.

However when the street is not straight, the centroids can be significantly off and misleading, for example this "J"-shaped section of road (West Dyke Road, TS10 4PS) and note the two locations of the postcode [1]. Could this be something to do with using bounding boxes?

I've also noticed a couple of other inexplicable location errors in my area, but perhaps that's to be expected with a first release.


Chris Hill said...

Hi @Jeremy,
Codepoint and Codepoint Open are different, Codepoint has more detail, is paid for and does not use an open licence. I've only looked at Codepoint Open which is available to use by anyone for any purpose and only requires attribution.

The link you gave is a comparison of Codepoint Open against the new Open Names. The red points are Codepoint Open, the magenta points are Open Names. If I overlay Codepoint Open with ONS postcodes they line up exactly, clearly Open Names are different, perhaps more precise.

Codepoint Open (and Open Names) defines the centroid of the area covered by that particular postcode, sadly it does not show the polygon that covers the area. A postcode can apply to a single building, usually a commercial building that receives a lot of post. A single building can have multiple postcodes too. In most streets a postcode applies to either the whole street or part of a street. It seems that postcodes usually only apply to a single street, not more than one. When it applies to part of a street that can be a section of a street or one side only of a street, this varies with no pattern that is clear to me.

I don't think there are errors in the dataset, but it can be hard to interpret given only the centroid. It's especially hard to understand where a postcode changes when there's more than one on a street. It's often at a junction of a side street, but not always. There's no way I know to verify this on the ground either, so local (very, very local) knowledge is all that's available to help in OSM.

Jeremy said...

I was comparing the two overlays on your oscompare site. Sorry for the confusion; I didn't know there were two versions of CodePoint (newbie mistake!)

As referred to in my previous comment, here are a few more examples where the OS Open Names postcodes are in unexpected places, compared to the red Codepoint Open postcodes which are correctly located (from my very, very local knowledge*);

-Dover Close,TS10 2QZ, a straight road that's wrong! [2];
-TS10 2EE,this is a short double-terrace called The Chase; the OS Open Names postcode is >700m to the North on the junction with Lord Street [3];
-TS10 1PJ,a single building, the school was on the (still) empty field where the OS Open Names postcode is shown, but it was demolished and re-built on the opposite side of Mersey Road in 2006! [4]

*my Local Authority's 'List of Streets' had a separate (though incomplete) itemised list of postcodes similar to those published in Thomsons directories in the early 1990s (of which my local library still has its copy!), but where this list came from...???


Chris Hill said...

I'm now seeing other reports of anomalies and possible missing data from this new postcode dataset. I'm going to chase up some examples and try to understand the issues then try to take it up with OS. Thanks for your examples. I'll write up any progress in this blog.

Anonymous said...

This is another useful tool

Investigating it I discovered the anomaly of YO10 3FP, which is either a typo or accident. Normally YO10 3## are north of Hull Road in York and YO10 5## are south (though this is less clear at the eastern end and there is the exception of Windmill Lane and its offshoots). Possibly this incorrect postcode was assigned to Constantine College before it was built ~2 years ago, now it is built none of the buildings have this postcode, they all have postcodes YO10 5F# with the central building (The Forum) being YO10 5FP.

I wonder how widely the faulty postcode is distributed and whether Royal Mail have made any attempts to correct it.


Chris Hill said...

From a few searches it looks as the that odd postcode is being used. Once issued I suspect it's too hard to change, even if it is a mistake.