Geocoding UK postcodes in ArcGIS

Say you did a survey and asked participants for their postcode, or you obtain secondary data in which locations are specified by postcode. Now you want to create a point on a map for each of your postcodes – in GIS jargon: you geocode your data.

You have various options for geocoding:

  1. UK academics and students can use the excellent MIMAS GeoConvert tool: You upload your file and it returns National Grid Reference Eastings and Northings for each of your postcodes. You can then easily visualize these in GIS software.
  2. If you are happy building your own web application you can use Unlock Places, a geocoding API provided by EDINA, It can be used with postcodes, but also with placenames. It also returns Eastings and Northings.
  3. You can do geocoding in ArcGIS Desktop – see instructions below. This is a bit more difficult to set up, but advantages are that (a) if you have a typo in a postcode ArcGIS can suggest corrections (while the other two will simply reject that postcode), and (b) it is more customizable – for example you can build your own postcode reference data if you want.

In this post I only cover the third option, geocoding in ArcGIS.

You need:

  • Your dataset with postcodes (obviously)
  • The ArcGIS Desktop software. We use ArcGIS Desktop 10.2.1.
  • An ArcGIS reference database containing all UK postcodes with their geographical locations. I built such a database based on the 2014-02 postcode directory from the UK data service, which itself is based on the ONS postcode directory. In addition to the postcode data my database contains an Address Locator – in ArcGIS jargon this is a set of rules to match your postcodes to the reference data. If you are a University of Manchester staff or student contact me for a copy of the database.

First you need to bring your postcodes in a format that is readable by ArcGIS. This can be an MS Excel table, but ArcGIS is quite strict in what it expects in table formatting: your data needs to be organized as one observation per row and the table must follow certain formatting rules. For example, this table is not well formatted and ArcGIS will not be able to read it:ExcelTableBadlyFormattedThe same table well formatted and readable in ArcGIS:

ExcelTableWellFormatted (Note that data source information and other metadata is moved to a separate worksheet.)

Once your table is well formatted, load it into ArcMap and open it to verify that it is read correctly:

ExcelTableWellFormattedInArcGISIf you see only blank cells here, your table does not follow ArcGIS formatting rules.

Now to the actual geocoding:

In ArcGIS display the Geocoding Toolbar (Custiomize > Toolbars > Geocoding):

ArcGISGeocodingToolbarClick on the Postbox symbol. You are asked to choose an address locator. This is the reference database to compare your location data to. ArcGIS comes with two built-in locators, but we want to a different one, the one from my UK postcode database. Click Add…, navigate into the geodatabase that you got from me, and add the locator ‘ONSPD_2014_02_UK_PT_Locator’.

ArcGISAddLocatorArcGIS takes a while to now process the locator – don’t despair. When it is done you see that it added the ONSPD locator to the list of available locators and made it the default locator (indicated by the asterisk *). Click OK to close the Address Locator Window.

Again ArcGIS thinks for a while, then it opens a Geocode Addresses window. Here you specify your own data:

ArcGISGeocodeWindow

  • Address table – this is your own Excel table. If your Excel table is already loaded into ArcGIS you can select it from the dropdown, otherwise load it.
  • Address Input Fields: For postcode data select Single Field, and for Key the field that contains your postcodes.
  • Output: The geocoding process creates a point feature class with one point for each row in your data. Specify a location and name to save this output, as a shapefile or geodatabase feature class.

Click OK.

Now ArcGIS goes through your table, looks up each postcode’s coordinates in the reference table, and creates a point feature at that coordinate in the output. Do NOT click Cancel, even if the progress bar arrived at the right – ArcGIS is still working. Only if you see the Rematch and Close buttons it has really finished:

ArcGISGeocodeReallyFinished

If you are happy with the geocoding result click Close the and you see your data on the map:

ArcGISGeocodeOutputIn the example above all my postcodes were ‘matched’, meaning a corresponding postcode was found in the reference database. If you get Tied or Unmatched postcodes these are usually due to typos in your postcode data. Double-check your data or see here how to rematch manually.

Notes:

Advertisements

7 thoughts on “Geocoding UK postcodes in ArcGIS

  1. Is this help only for University of Manchester staff and students?i want to use this method but cant get the address locator..Im from the University of Brighton.please assist

    1. I wrote that post some time ago for University of Manchester students who I would provide with the address locator. I don’t work there anymore and don’t have access to the address locator database anymore (and it would be out of date anyway).
      I suggest:

  2. I have postcodes for long term care providers and for NHS trusts. I want to geocode these postcodes into ArcGIS, calculate their respective centroids and then the straight line distance between these points. My objective is to find which long term care providers are within 10 km of each NHS trust. Is is possible in ArcGIS?

    1. This is definitely possible. There are three steps involved: 1. Geocode your care providers dataset; 2. Geocode your NHS trusts dataset; 3. Use the ArcGIS Near tool or Generate Near Table to calculate straight line the distances. If you work in British National Grid coordinates, all data will be in meters, and the calculated distances will be in meters too.

  3. Very useful article. I look to covert from postcodes of NHS sites to shapefile. I struggle to find “ONSPD_2014_02_UK_PT_Locator”. Can you let me know where it is located? Many thanks. Dapeng

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s