Reputation:
Where can I find a list of all UK full postcodes including street name and their precise coordinates? They should be not like AB1, AB23 etc but AB1 2AA, AB23 5ZZ etc.
Preferably for free :)
Thanks
Upvotes: 23
Views: 55516
Reputation: 462
Here is the list in csv
https://raw.githubusercontent.com/Gibbs/uk-postcodes/master/postcodes.csv
More details : https://github.com/Gibbs/uk-postcodes
Upvotes: 2
Reputation: 1677
You can now get postcode data for free from the Ordnance Survey https://www.ordnancesurvey.co.uk/business-and-government/products/code-point-open.html This doesn't come with street names though
If you want the data converted to lat/long then you can grab it from my site http://www.doogal.co.uk/UKPostcodes.php
Upvotes: 27
Reputation: 31
As part of a freelance project in PyQt I've written an algorithm to get user input of postcode and return the street name for it. For anyone who's looking for an alternative to commercial systems, open-source and straightforward approach to this issue can use it freely.
I've written it in Python2.7 but can easily be replicated in the newer versions or in other languages.
import urllib
from urllib2 import urlopen
import json
try:
google_map_key = raw_input("please enter your google maps api key: ")
postcode = raw_input("Please enter a UK Postcode: ")
postcode = postcode.replace(" ", "")
url = "https://maps.googleapis.com/maps/api/geocode/json?address="+postcode+"&key="+google_map_key
response = urlopen(url)
json_obj = json.load(response)
counter = 0
if json_obj['status'] == 'OK':
for i in json_obj['results']:
for x in i['address_components']:
counter += 1
if counter == 2:
print ("Long street name: " + x['long_name'])
break
else:
print("No results found! Please enter a valid postcode or check your internet connection and google api key")
except:
print("Unhandle exception")
Upvotes: 3
Reputation: 91
Also try here for UK. http://www.freemaptools.com/download-uk-postcode-lat-lng.htm
Upvotes: 3
Reputation: 3435
You can download the entire GB postcode data complete with Lat and Long values from here completely free:
http://download.geonames.org/export/dump/
Simply scroll down to GB.zip There are also other countries postcode info, I have used Germany and Poland data and they are also OK.
Upvotes: 4
Reputation: 310
The OS "free" version is useful, but it does have a few limitations, for example no data for Northern Ireland, the Isle of Man, Guernsey or Jersey.
I vote for Doogal's version with the extra latitude and longitude data, which is more useful for geo-mapping like OpenLayer.
Upvotes: 2
Reputation: 27294
The Royal Mail is the supplier of the 'official' Post Code database for the UK - they own the postcodes and postcode to GIS mapping. It's copyrighted and has some significant license fees.
Postzon is the product they sell to link the postcodes to the GIS co-ordinates.
There have been third party providers from outside europe who released details in the past for a fraction of the costs, but it's a very grey area, and you are then in consult a lawyer territory.
Upvotes: 2
Reputation: 26599
Unfortunately this is something you have to pay for, and it's not particularly cheap! There's an online petition to get this information freed if you are interested.
Commercial wise, just do a Google for uk postcode database and take your pick, they are all much of a muchness.
Upvotes: 2