 |
Formula for the distance calculation between two coordinates on earth
To achieve the best possible ratio of accuracy and performance, we have decided, that the acutal shape of the earth can be neglected (it is a so calles "ellipsoid") and therefore use formulas based on the mathematical solutions for spheres.
The initial point of any calculation are the two points the distance is supposedly calculated for:
Example: Frankfurt (Germany) N 50° 06' 44" / E 008° 40' 55"
(reads: "50 degrees, 06 minutes and 44 seconds north and 8 degrees, 40 minutes and 55 seconds east")
and Berlin/Germany N 52° 31' 20" / E 013° 17' 51"
Conversion of the degrees, minutes and seconds in a decimal value:
Latitude Frankfurt.: 50 + (06 / 60) + (44 / 3600) = 50.11222°
Longitude Frankfurt: 08 + (40 / 60) + (55 / 3600) = 8.68194°
Latitude Berlin....: 52 + (31 / 60) + (20 / 3600) = 52.52222°
Longitude Berlin...: 13 + (17 / 60) + (51 / 3600) = 13.29750°
Version A of the calculation (for programs/software that can only calculate angles with radian functions)
Conversion of the coordinates in radian values:
Latitude Frankfurt.: (LAT1) 50.11222° / 180 * PI = 0.87462
Longitude Frankfurt: (LONG1) 8.68194° / 180 * PI = 0.15153
Latitude Berlin....: (LAT2) 52.52222° / 180 * PI = 0.91669
Longitude Berlin...: (LONG2) 13.29750° / 180 * PI = 0.23209
The formula uses the distance calculation on a sphere:
e = ARCCOS[ SIN(LAT1)*SIN(LAT2) + COS(LAT1)*COS(LAT2)*COS(LONG2-LONG1) ]
e = ARCCOS[ SIN(0.87462)*SIN(0.91669) + COS(0.87462)*COS(0.91669)*COS(0.23209-0.15153) ]
e = ARCCOS[ 0.60892 + 0.38893 ]
e = 0.06559
Version B of the calculation for most modern programs and software using angle-calculations without radian values:
The formula uses the distance calculation on a sphere:
e = ARCCOS[ SIN(LAT1)*SIN(LAT2) + COS(LAT1)*COS(LAT2)*COS(LONG2-LONG1) ]
e = ARCCOS[ SIN(50.11222)*SIN(52.52222) + COS(50.11222)*COS(52.52222)*COS(13.29750-8.68194) ]
e = ARCCOS[ 0.60892 + 0.38893 ]
e = 3.75781 / 180 * PI = 0.06559
Now, the obtained result must be multiplied with the radius of the equator:
Distance = e * r = 0.06559 * 6378.137 km = 418.34 km or
Distance = e * r = 0.06559 * 3963.191 miles = 259.95 miles
Should you use this example and obtain a distance of 572 km (357.5 miles) you may have used version A of the formula, but have not switched to radian-bases calculations.
Please note, that this formula is only applicable for calculations on the northern hemisphere of earth and east of Greenwhich ("N" and "E" in the coordinates). You can use the formula for other coordinates south of the equator and west of Greenwhich by simply multipliying the coordinate-values with "-1".
All informations and calculations are given without any warranty and may contain errors.
|
 |