ZIP / Postal Code + Country to Geo Coordinates

倖福魔咒の 提交于 2019-12-03 02:43:07

Yahoo! GeoPlanet will give you centroid lat/long points for postal codes. They've been reliable in my experience. The API limit is 50,000 requests per day. I'm not sure what their policy on caching results is. I get the impression that if you contact Yahoo!, you can set up an arrangement with a higher request limit, though it may cost some money.

They also let you download a substantial portion of their data under a Creative Commons license, but unfortunately that appears to be limited to the WOEID relationships and country names.

I think that your choice will probably depend on how many API call you intend to make per day. The daily limit of the free Google Maps API is 15,000 request per IP address. (Source: Google Maps API FAQ.)

You can do geocoding with Google Maps API using the following HTTP request:

Simple CSV:

http://maps.google.com/maps/geo?q=W1A+1AA,+London&output=csv&sensor=false

More Complex XML:

http://maps.google.com/maps/geo?q=W1A+1AA,+London&output=xml&sensor=false

Simply change the "q" parameter with the postcode and country to geocode.

However, I think that storing the geocoding results permanently in your database may be a violation of the Google Maps API terms and conditions. You may want to check for more information about these restrictions.

The easiest way would of course be finding a high-quality service provider with no request limit. Why not ask Google for an offer? From what I hear, they are quite flexible towards business customers.

If that's not an option, you will certainly be able to get individual data files, and fare cheaper than 33 grand in many countries. I'm quite sure German and Austrian sell data files at 3-figure prices, and for the UK there's the Postcode Address File (PAF) it's data from the Royal Mail, I don't think quality gets better than that. Of course, in addition to the cost and hassle, there would be a lot of converting work to do with 26 individual files from different Post offices and whatnot - work I wouldn't envy anybody for :) If you have the budget, it's probably cheapest to talk to Google or Yahoo.

That's actually a really tough problem since a ZIP code is not actually a polygonal region, but a set of lines aggregated together (see the best anser to How to get the bounding coordinates for a US postal(zip) code? for a very detailed explanation of this.)

Within the United States, the Census Bureau maintains a list of approximate Zip Code boundaries called the "Five digit Zip Code Tabulation Areas" (ZCTA5). You can download these directly and process them however you like. There are several geocoding tools which can get you started with this; I use PostGIS (http://postgis.net/) but there are others, most importantly the Open Street Maps data (http://www.openstreetmap.org), which covers the world.

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