How do I match street addresses to UK postcodes?

25.7k views Asked by At

U.K. sites that require addresses often ask the user to provide a postcode. The site then offers the user a choice between the different addresses that match that postcode.

How can I match a postcode to a street address?

12

There are 12 answers

5
Brian Agnew On BEST ANSWER

I believe you need the Royal Mail Postcode Address File. From that link:

PAF is the only complete source of all known UK Postcodes.

Services do exist to handle requests for this info, such that it may be cheaper to use such services for small numbers of requests (obviously you have issues as and when such services aren't available for whatever reasons).

1
Lee Smith On

You don't need to purchase the Royal Mail Postcode Address File (PAF). There are lots of APIs available.

getaddress.io is the only one I've found that has a free plan:

https://getaddress.io

0
mikemaccana On

Quick comparison:

0
davek On

You can use a geocoding service, such as the one provided by Google.

Physical Address to GeoLocation UK

0
Murph On

To do this you need access to the Postcode Address File - this is something that is licensed for use on an annual basis from the post-office, usually via a third party.

You have a choice depending on your needs of buying a package to use locally or of using web services.

The Royal Mail's page is here: http://www.royalmail.com/portal/rm/jump2?mediaId=400085&catId=400084 and on that page are links to service providers.

3
James Bloomer On

The only way to do it officially up to now has been to buy the Postcode Address File however there was a news item recently that the data may be free in 2010 so depends if you can wait!

0
dsas On

You can either use the PAF or one of the commercial web services (there are a few) which licence the PAF. I think you usually buy "credits" or pay a flat rate for unlimited access.

1
Ben On

Postcode Anywhere is one of the providers out there (one of my clients uses them with no complaints). Licensing is flexible: Postcode Anywhere UK Address Finder

0
hawbsl On

To add to the answers already coming through:

In the paid for products typically you pay for either:

  • premise level - more detailed and can offer the user a list of premises at that postcode location

  • street level - simply matches the street at that postcode location - you or your user fills in "the first line of the address" usually house name or number

I believe this differentiation is built into the licencing by the Royal Mail at source. Premise level is substantially more expensive

1
Richard H On

Contrary to the answers here, you do NOT need the very expensive PAF from the Post Office. There are a number of commercial services (presumably powered by the PAF) that return the streets and street numbers for a specified post code. They generally charged on a per-request basis. I do not have any experience with a particular vendor, but this is an example - capscan

0
AudioBubble On

If you're adding it into a website shopping cart or similar system, you can buy access to the data on a per-click basis. If you're using it for an internal system such as CRM, you need to buy a per-user license.

Either way, you can use the Data8 Postcode Lookup API via web services.

0
jthompson On

If you want to get the approximate address for a UK postcode (i.e. street level) there is a way you can do it legally and for free without using PAF data.

  1. Geocode the postcode - This can be done legally for free now. OS have released the codepoint database into the public domain
  2. Do a reverse lookup on the WGS84 lat/lng pair using the Google Maps HTTP Geocoding API to get the street address

As an example of this take a look at this XML Web Service:

http://geo.jamiethompson.co.uk/W127RJ.xml

explained at:

http://jamiethompson.co.uk/projects/2010/04/30/an-open-free-uk-postcode-geocoding-web-service/

which returns:

<result>
    <status>200</status>
    <message/>
    <postcode>W12 7RJ</postcode>
    <geo>
        <os_x>523180</os_x>
        <os_y>180541</os_y>
        <lat>51.510379</lat>
        <lng>-0.226376</lng>
        <landranger>TQ231805</landranger>
        <accuracy>1</accuracy>
        <key>UO1NV-4UO8</key>
    </geo>
<address>
    <street>White City Close</street>
    <locality>Hammersmith</locality>
    <district>Hammersmith</district>
    <county>Greater London</county>
</address>

It's not as handy as the commercial offerings which give you a full list of actual addresses for any given postcode, but it lets you do a "What's your postcode? What's your house number?" type system.