Where can I find a list of all UK _full_ postcodes including street name and their precise coordinates?

那年仲夏 提交于 2019-12-02 19:13:31
Doogal

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

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.

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.

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.

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.

Murat Sert

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")
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!