Need to find latitude and longitude of postcodes and store into my database [closed]

二次信任 提交于 2019-11-30 23:29:49
Ben

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".

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 ^^

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

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.

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.

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

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.

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