Welcome to MapForums!

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

## how to calculate distance between 2 towns

This is a discussion on how to calculate distance between 2 towns within the MapPoint Desktop Discussion forums, part of the Map Forums category; I m a newbie and i want calculate distance between 2 towns in asp or vb how to do? thank...

1. Senior Member Black Belt
Join Date
Jul 2002
Posts
5,137

## how to calculate distance between 2 towns

I m a newbie and i want calculate distance between 2 towns in asp or vb
how to do?
thank

2. Senior Member Black Belt
Join Date
Jul 2002
Posts
5,137

## how to calculate distance between 2 towns

Hi :o)

I have the same problem but in c#
Also I need to know the time it take to drive based on speed limit.

So:
How do I get the distance?
How do I set the speed limits on different road type?
How do I get the time it take to drive the distance?

Zindy

3. Junior Member White Belt
Join Date
Dec 2002
Posts
8
Hi,

First, you declare 2 objects like "MapPoint.Location": Loc1 and Loc2

You will have to localise two place (with the "FindAddressResults" method or the "FindResults" methode of a Map).
With this methode, you receive a list of place. You take one and you place them in the Loc1 and the Loc2.

Then, you call the "oMap.distance(Loc1, Loc2)" method of Map that return a Double.
If you have any problem, call me !!

Bye.

4. Junior Member White Belt
Join Date
Jun 2003
Posts
2
I think there are quite a few ways of doing it:

1. Method suggested by Val
2. Use Loc1.DistanceTo(Loc2)
3. Add the locations as waypoints of a route. then use route.calculate and Route.distance

the first two methods give the same distance. however the 3rd one gives a different distance(the actual travel distance i guess). I am not sure as to why each of these methods give different numbers. can anyone help?

thanks,

arun.