Find location by zip code

AurA picture AurA · Mar 19, 2012 · Viewed 15.8k times · Source

I am looking for a google API or any other API that returns me location ( in the form of latitude/longitude or place name )

Using Geocoder I can find lat,long as long as I know the name of place.

It can we a web service or some query to some online database. I don't want to populate the US Zip codes to a local database.

Answer

Andrew Leach picture Andrew Leach · Mar 19, 2012

Google's webservice and the Javascript geocoder both geocode zipcodes on their own without an explicit placename. There is a rate limit and a daily limit with both. Google's Terms of Service don't permit permanent storage of geocoded data — which you don't intend to do — but they do mandate displaying the geocoded point(s) on a Google map (which you may not be intending to do).

Five-digit zipcodes default to the USPS codes, I believe. For other countries' five-digit codes you need to specify the country.

Edit:

Documentation for Javascript API: https://developers.google.com/maps/documentation/javascript/geocoding
Example for Javascript API: https://google-developers.appspot.com/maps/documentation/javascript/examples/geocoding-simple (try entering 90210)
Documentation for webservice: https://developers.google.com/maps/documentation/geocoding/
Example request: http://maps.googleapis.com/maps/api/geocode/xml?address=90210&sensor=false

You may find that certain countries' postal codes don't work. But to make the blanket statement they are not providing location search based on zipcode is not correct. If you are having difficulty with a particular country's postal codes — like India's PIN code perhaps — it's best to be specific.

Edit #2:

If you are interested in Indian pincodes then a top-ranking Google result was this thread: https://groups.google.com/group/datameet/browse_thread/thread/db5b8a3f4033ae36