4

I’ve got a database full of UK Postcodes, now I’d like to be able to store the latitude and longitude of these specific postcodes along with the record with the database. Is there any way that I can obtain this data free without violating any T&C's?

I know I could do this using Google maps API for each postcode, but I have way over 20,000 postcodes in this database and to get the lat and lng for each of these postcodes each time is not an option really.

Thanks in advance, M

Samuel Liew
  • 76,741
  • 107
  • 159
  • 260
phpNutt
  • 1,529
  • 7
  • 23
  • 40
  • The same question was asked yesterday and got good answers. Hang on... – Pekka Apr 15 '10 at 09:31
  • 1
    Check out Rowland Shaw's answer here: http://stackoverflow.com/questions/2621844/fetch-latitude-longitude-by-passing-postcodes-to-maps-google-com-using-javascript – Pekka Apr 15 '10 at 09:32
  • postcode location data is free now ... see below. – Ben Feb 11 '12 at 21:19

7 Answers7

3

Postcode location data is available free now. See this answer:

https://www.ordnancesurvey.co.uk/opendatadownload/products.html

The one you want is "Code-Point open".

Community
  • 1
  • 1
Ben
  • 34,935
  • 6
  • 74
  • 113
1

Here it is. Dumped SQL table full of Postcodes, LAT/LON, X/Y coordinates :)

Download zip (UK-Postcodes.zip) and for more info read [same-website]/guides/article.php?article=64 :)

I haven't tested it, but it should be working, lad :)

Happy coding ^^

Nikola
  • 371
  • 1
  • 9
  • 19
0

Maybe Nominatim should do the trick. The only problem is that it might not be up to date.

npinti
  • 51,780
  • 5
  • 72
  • 96
0

Geonames.org offers a free downloadable database. You could try Bing API or other commercial offerings but they have rather restrictive T&C in how many queries you can make within a time period, how you can use it (needs a lawyer to interpret their nuances).

I found Geonames.org to be more than sufficient for my needs.

Mikos
  • 8,455
  • 10
  • 41
  • 72
0

For postcode database, unfortunately I cannot help you.

But for Google... You know, you don't have to do this for EVERY postcode EACH time. You can cache the values in your database and do it only once for each new postcode. Although this will take some time, it's possible.

Yeah, it still sucks. But better than nothing.

Tomasz Struczyński
  • 3,273
  • 23
  • 28
0

http://www.freethepostcode.org/ provides information you may find useful.

AakashM
  • 62,551
  • 17
  • 151
  • 186
0

I've only seen this done from a local database with commercial software, possibly because of the licensing restrictions the Royal Mail put on their postcode data.

There are APIs with reasonably high rate limits that can geocode UK postcodes, though. Yahoo's geocoding API is restricted to 5,000 hits a day, but that means you could have your entire database done in four days, store the lat/lon in the database, and just use it to add new addresses as they come in, say.

Also -- how accurate do you need the information? If you just need a rough location, you could geocode to the Outbound (e.g. "BS1"); I've seen user-sourced databases of at least arguable legality around the net for that.

Matt Gibson
  • 37,886
  • 9
  • 99
  • 128