Domanda

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.

È stato utile?

Soluzione

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

Altri suggerimenti

GeoNames provides several geolocation related web services including lat/long information for zip codes.

There are some public webservices on the internet - here's one that returns place names (and other information) for zip codes:

  • USZip (Select GetInfoByZIP)

If you're in the UK then the only way to effectively do this using Google Maps API is to write it in javascript due to the limitation Google place on the number of API calls per day from a single IP address.

If yous solution is going to be under moderate usage load then you may want to look at a solution that utilises the UK Royal Mail PAF file. One such service that I've integrated with for my work is Postcode Anywhere (www.postcodeanywhere.com). They have a great API available in various formats... it was the easiest integration I've done lately.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top