UK Postcode mapping in 5 minutes
I have read a number of posts lately detailing approaches for handling mapping postcode data in the UK, so I thought I would write another one. I think this is the fastest way to achieve it.
To map postcodes in Tableau, you somehow need to get the postcode
converted to a latitude and longitude. There are many ways to do this, but I think this has the least steps.
Follow these steps to map the OUTCODE (the left hand side of a post code) to a Lat/Long. The assumption is that you already have a dataset which includes POST CODE
Minutes 1 and 2 – Add a csv file to your copy of Tableau desktop, this tells Tableau the Lat/Long of the outcodes
You’ll need a csv file of outcodes, so I have posted one here. Copy this file and save it.
Add it to tableau LIKE THIS… Choosing the csv file from your save location.
Minute 3 – Create a calculated field which grabs the outcode from the postcode. The function for the calculated field is something like this:
left([Postcode], find([Postcode], ” “)-1)
This finds the space in the postcode, and returns the left portion which is equivalent to the outcode in the csv file.
Minute 4 – Change the ‘geographic role’ of your calculated field to be outcode. Outcode is now available as a geographic role because of the csv file added
Minute 5 – Now you should be able to plot the outcode against a measure. Select the outcode field, select ‘number of records’ (for example) and show me should now offer you a map. Hey pesto, postcode mapping!