I've had a request recently to generate a map which includes UK Postcode districts, ie aggregations of postcodes based on the first section of the code (NW2, B1, E11 etc.).

From what I've read, these aren't available freely (Postcode Shape Files for the UK).

Is there a way of scripting aggregation of boundaries in either QGIS (or possibly R)? I've done this sort of aggregation before using MapBasic but no longer use MapInfo (plus it gave really messy boundaries).

I'm thinking I may use Voronoi regions rather than the actual postcode boundaries as this will be easier in terms of file handling (my postcode shapefiles are split across lots of files so easier just to run Voronoi on the OS Codepoint data set, plus I imagine this will give cleaner, if less accurate, boundaries)

  • this API will give you UK postal unit level boundaries(ZE1 0AE) which does voronoi already.., district(NW2) and sector, for example, ZE10 check out www.boundaries-io.com
    – Jeryl Cook
    Commented Aug 19, 2017 at 17:08

2 Answers 2


if you are using postgis (SPIT plugin) with qgis, you can use ST_ConcaveHull function for aggregation of boundaries.

i hope it helps you...

  • Thanks I'll take a look into this, though wonder if I'll be scuppered by my work firewall! I was just looking at this as well: PyQGIS
    – Tumbledown
    Commented Dec 6, 2012 at 9:59

Thanks to Aragon but I found a simpler solution. I ended up using the dissolve function in QGIS. I didn't realise it was possible to do this based on a grouping value. It took a long time to process but got the job done with minimal effort. Definitely a case where learning the correct terminology probably would have gotten me to the answer faster.

As a side note, it turns out the same technique (dissolved Voronoi regions) was used to generate the postcode district maps on Wikipedia. The only downside is that some clean up is needed on the resulting polygons.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.