data, data journalism

How to: convert postcodes to lat/long

Sometimes you get the locations of your data in postcodes and you need the latitude and longitude to depict the story in a map.

To show you how to convert postcodes to lat/long, I am going to use a spreadsheet on the number of takeaways in Birmingham.

The Food Standards Agency API facilitates the number of food establishments in XML format. Convert the file to a spreadsheet and filter for takeaways only.

You will get the locations with postcodes:

Screen Shot 2016-02-12 at 19.59.02

1. Paste the postcodes on Doogal 

Useful website to geocode a large number of addresses, postcodes or ZIP codes. Copy the postcodes from your spreadsheet and paste them into the ‘addresses’ box on Doogal.

There are some options such as the country of the addresses or the format of the text.

Screen Shot 2016-02-12 at 20.00.04

2. Click on Geocode

The postcodes will be converted to lat/long and placed on a map:

Screen Shot 2016-02-12 at 19.54.12

3. Copy the long/lat 

On the ‘Text’ mode are the latitude and longitude. Copy this information and go to the spreadsheet:

Screen Shot 2016-02-12 at 20.01.12

4. Paste the geolocations on the spreadsheet

Create two columns next to the PostCode column. Click on a cell next and paste the information:

Screen Shot 2016-02-12 at 20.02.37

5. Place your data in a map [optional]

With the number of takeaways and the geolocation you can now display the information on a map using CartoDB (like this example) or other interactive websites:

Screen Shot 2016-02-12 at 20.09.45

Do you have any other examples? Let me know in the comments


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s