DotNet way to calculate distances between cities

  • Thread starter Thread starter Doug
  • Start date Start date
D

Doug

Is there a way to calculate miles between two places in DotNet? Is
there a third party tool available that can be incorporated into
DotNet that would work well?
 
There's the Haversine formula (not in the framework, but easy to
reproduce):

http://en.wikipedia.org/wiki/Haversine_formula

--
Jon Skeet - <[email protected]>
Web site:http://www.pobox.com/~skeet 
Blog:http://www.msmvps.com/jon_skeet
C# in Depth:http://csharpindepth.com

Wouldn't you need to know the longitude and latitude for that to
work? Obviously I know you need to have some basis to start
with...but is there something out there that has that available? I.E.
if I said Chicago, Illinois, is there something that would give me the
longitude and latitude for that (dotnet or third party)?
 
Doug said:
Wouldn't you need to know the longitude and latitude for that to
work?

Yes. I was assuming you had that.
Obviously I know you need to have some basis to start
with...but is there something out there that has that available? I.E.
if I said Chicago, Illinois, is there something that would give me the
longitude and latitude for that (dotnet or third party)?

There may be publicly available lists around - the only time I've dealt
with geographic data like this it's been as part of another API which
had all the longitude and latitude data.

Just a very quick search on the net finds some results though, e.g.
http://www.bcca.org/misc/qiblih/latlong_us.html
 
Doug said:
Wouldn't you need to know the longitude and latitude for that to
work? Obviously I know you need to have some basis to start
with...but is there something out there that has that available? I.E.
if I said Chicago, Illinois, is there something that would give me the
longitude and latitude for that (dotnet or third party)?

Google Maps has an API that returns information (including latitude and
longitude) for the location that you supply, such as "Chicago, Illinois".
Requires (free) registration to get a Key that lets you activate the API.
http://code.google.com/apis/maps/documentation/services.html#Geocoding_Direct
 
Back
Top