Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ZIP / Postal Code + Country to Geo Coordinates

What is the most complete, precise and reliable way to get the coordinates (latitude / longitude) of a given ZIP / Postal Code of a given country? I need to make a lot of requests, so a high API limit rate (maybe even absent) would be useful.

GeoNames dumps would be cool, but it seems to have way too many duplicate coordinates (example) and it also seems that their database is missing some ZIP / postal codes for specific countries.

Are there any other (reliable) alternatives?


While I was reading a Meta question, I came across this link:

http://query.yahooapis.com/v1/public/yql?q=select%20%2A%20from%20geo.places%20where%20text%3D%22Jyv%C3%A4skyl%C3%A4%22&format=xml

I had heard of the YQL before but I had no idea I could use it to GeoCode addresses, so I searched a little and I found this very interesting piece of information:

Usage Limits

Per application limit (identified by your Access Key): 100,000 calls per day

Per IP limits: /v1/public/: 1,000 calls per hour; /v1/yql/: 10,000 calls per hour

Does anyone know where I can get more specific info in using YQL to GeoCode addresses?

like image 734
Alix Axel Avatar asked Jan 16 '10 13:01

Alix Axel


People also ask

How do I geocode a zip code?

Geocode (Lat/Long) Three ways to use Geocode Lookup: Enter a 5-digit ZIP Code (i.e. 92688). Enter a 9-digit ZIP+4 Code (i.e. 92688-0001) Enter an Address ( Address format: Address, City, State separated by commas)

How do I find the longitude and latitude of a zip code in Excel?

To get the latitude of the address in cell B2, use the formula = GetLatitude(B2) To get the longitude of the address in cell B2, use the formula = GetLongitude(B2) To get both the latitude and longitude of the address in cell B2, use the formula = GetCoordinates(B2)

How do I find GPS coordinates from a street address?

Open the Google Maps website and enter the address details in the search box. The map should center on the address you entered. Right-click on the location. Using your mouse right-click on the address pin marker.


2 Answers

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.

like image 133
npdoty Avatar answered Nov 14 '22 04:11

npdoty


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.

like image 38
Daniel Vassallo Avatar answered Nov 14 '22 02:11

Daniel Vassallo