I’m building a web based application to determine a value, which consists the calculation of the distance between X city to Y city (US).
Is there a data resource to pull that information?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can get the latitude and longitude of your cities from a map API. I use Yahoo’s because their terms of service fit better with my needs, but the Google API is certainly a good choice as well.
The Yahoo API is described here
http://developer.yahoo.com/geo/placefinder/
Once you have the latitude and longitude, you can find the distance either using a fairly straightforward formula
Calculate distance between two latitude-longitude points? (Haversine formula)
or with another API:
http://developer.yahoo.com/flash/maps/classreference/com/yahoo/maps/api/utils/Distance.html