Find locations using zip codes, cities or coordinates

≯℡__Kan透↙ 提交于 2019-12-13 05:40:01

问题


I need to code a finder of cities in a radius of X km. of a given one using a ZIP code or a city. Something like this:

Enter ZIP code or city: [            ]
Choose Radius in Km.    (10) (20) (30)
-------------------------------------------
[ Submit ]

So I need a database relating zip codes, coordinates and city names. (not for USA, Germany) Anyone know of any? Or a ready to use web service or whatever that allow me go to the beach earlier?

THX.-


回答1:


I just found this:

http://api.geonames.org/findNearbyPostalCodes?postalcode=8775&country=CH&radius=10&username=demo

http://www.geonames.org/export/client-libraries.html (several client libraries to request geonames service)

Exactly what I want for Christmas. THX.-




回答2:


If you can get hold of the coordinates of each location (zipcode - longitude - latitude) you can calculate the distance

You could use http://developer.yahoo.com/geo/geoplanet/guide/index.html to get the longitude and latitude for a place then use the calculation to create the distance.

Calculating distance between zip codes in PHP



来源:https://stackoverflow.com/questions/5123338/find-locations-using-zip-codes-cities-or-coordinates

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