Earth Distance Formula

The approximate distance between the two locations on the planet can be determined with their geographic coordinates and this formula

$$d = \sqrt{\left ( \frac{r\pi(\mbox{Lat}_2 - \mbox{Lat}_1)}{180} \right )^2 + \left ( \frac{r\pi(\mbox{Long}_2 - \mbox{Long}_1)}{180} \right )^2}.$$

The radius r in this instance is the radius of the earth. The units that the final distance d is measured in is the same as that you used for the radius.

The formula above is not 100% accurate. That would be impossible, because the earth is not a perfect sphere and the exact radius of the earth is not known. The radius of the earth has been estimated to be AbOUT 6,378.135 km (3,963.189 mi; 3,443.917 nm).

Derivation of the Formula

First, all you should have are the sets of coordinates. The latitudinal angle between each location is Lat2 − Lat1 and the longitudinal angle is Long2 − Long1.

If you were to slice a thin layer of the earth out at the equator, you would have a circle. To find the arc length on a circle given an angle and the radius, the following formula can be used to find the latitudinal and longitudinal distances

$$\begin{matrix}s = r\theta.\end{matrix}$$

These distances also form the legs of a right triangle on a flattened surface. To use this formula, your angles must be in radians. To convert the angles from degrees to radians the concept

$$\angle (\mbox{radians}) = \frac{\pi\angle^\circ}{180}$$

will work.

Since the following equations summarizing the above equations are the formulas for the lengths of legs of a right triangle

$$\begin{matrix}s & = & r\theta \\ s_1 & = & \frac{r\pi(\mbox{Lat}_2 - \mbox{Lat}_1)}{180} \\ s_2 & = & \frac{r\pi(\mbox{Long}_2 - \mbox{Long}_1)}{180}, \end{matrix}$$

the distance formula will give the length of the hypotenuse, or the geographic distance between each location.