View Single Post

  #3 (permalink)  
Old 01-19-2007
Wilfried Wilfried is offline
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
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;
Reply With Quote