开发者

How can I get the Latitude and Longitude of a ZIP Code?

开发者 https://www.devze.com 2023-03-04 04:48 出处:网络
I need some help to get the Latitude and Longitude dynamically of a ZIP Code entered by t开发者_StackOverflow中文版he user. so that i can work to show the shop address on those area of zip code.Google

I need some help to get the Latitude and Longitude dynamically of a ZIP Code entered by t开发者_StackOverflow中文版he user. so that i can work to show the shop address on those area of zip code.


Google is running some kind of geocoding, you should check it out, it might help you http://code.google.com/apis/maps/documentation/geocoding/


http://code.google.com/apis/maps/documentation/geocoding/

There is some requirements for that like you have to register your google account for that but it's very easy and you have to pass some parameter which is describe at there.

You can make using JSON or XML as per your requirements.


You haven't specified what country you're looking to do this for but you can use the GeoNames API for postalCodeSearch.

For example (XML and JSON responses respectively)

http://api.geonames.org/postalCodeSearch?postalcode=90210&username=demo
http://api.geonames.org/postalCodeSearchJSON?postalcode=90210&username=demo


Going a little more in depth, you can get a JSON encoded object from google from the following url:

http://maps.googleapis.com/maps/api/geocode/json?address=ZIPCODE&sensor=false

just replace the ZIPCODE with the zipcode that you would like and it should return to you a json object with the latitude and longitude coordinates.

0

精彩评论

暂无评论...
验证码 换一张
取 消