Welcome to MapForums!

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

## Distances 'as the crow flies'

This is a discussion on Distances 'as the crow flies' within the MapPoint Desktop Discussion forums, part of the Map Forums category; How do I calculate the straight line distances between two locations?...

1. Junior Member White Belt
Join Date
Jan 2007
Posts
1

## Distances 'as the crow flies'

How do I calculate the straight line distances between two locations?

2. Senior Member Green Belt
Join Date
Sep 2005
Location
Battle Creek, Michigan
Posts
136

## Re: Distances 'as the crow flies'

Try googling for "Great Circle Distance"

An implementation using latitude/longitude points in VB.Net would be:
Calculate Distance and Radius in VB.NET - Visual Basic , VB.NET

3. Senior Member Black Belt
Join Date
Nov 2004
Location
Belgium
Posts
2,433

## Re: Distances 'as the crow flies'

Hi,

Here is a code sample in Delphi:

Code:
```function TRefPoints.GetDistance(Lat1, Lon1, Lat2, Lon2: double): integer;
var
Lat, Lon, Dist: double;
begin
Lat := Lat2 - Lat1;
Lon := (Lon2 - Lon1) * Cos(DegToRad((Lat1 + Lat2) / 2));
Dist := Hypot(Lat, Lon);
Result := Round(Dist * 1.852 * 60000); // meters
end;```

4. Senior Member Green Belt
Join Date
Sep 2005
Location
Battle Creek, Michigan
Posts
136

## Re: Distances 'as the crow flies'

Of course, since this is MapPoint we're dealing with...
Look at the methods

Map.Distance(Loc1,Loc2)
and
Location.DistanceTo(Loc)

Can't believe I didn't mention this in my first reply.

5. Senior Member Black Belt
Join Date
Nov 2004
Location
Belgium
Posts
2,433

## Re: Distances 'as the crow flies'

Hi Paul,

Agreed, but the latter is very slow. If it is needed to do many calcultions at once then own written is mutch faster.