What is the best way to calculate the great circle distance (ignoring elevation differences) between 2 points?
If the distance is less than about 20 km and the locations of the 2 points in Cartesian coordinates are X1,Y1 and X2,Y2 then the Pythagorean Theorem d = sqrt((X2-X1)^2 + (Y2-Y1)^2) will result in an error of: less than 30 meters for latitudes less than 70 degrees; less than 20 meters for latitudes less than 50 degrees; less than 9 meters for latitudes less than 30 degrees. Otherwise, presuming a spherical Earth with radius R (see below), and the locations of the 2 points in spherical coordinates (longitude and latitude) are lon1,lat1 and lon2,lat2 then Sinnott’s Formula (from R.W. Sinnott, “Virtues of the Haversine”, Sky and Telescope, vol. 68, no. 2, 1984, p. 159): dlon = lon2 – lon1 dlat = lat2 – lat1 a = sin^2(dlat/2) + cos(lat1) cos(lat2) sin^2(dlon/2) c = 2 arcsin(sqrt(a)) d = R c will give mathematically and computationally exact results. The intermediate result c is the great circle distance in radians. The Pythagorean flat-Earth approximation assumes not only that great circles