Associated Topics || Dr. Math Home || Search Dr. Math

### Distance Calculation

```
Date: 6/8/96 at 18:4:20
From: Nic Preller
Subject: Distance calculation

If I have the co-ordinates of two places in Degrees Latitude and
Longitude, how do I calculate the distance in nautical miles?
```

```
Date: 6/8/96 at 18:51:44
From: Doctor Anthony
Subject: Re: Distance calculation

This can be done fairly easily by using the scalar product of
two vectors to find the angle between those vectors. If the
vectors are OA and OB where A and B are the two points on
the surface of the earth and O is the centre of the earth,
the scalar product gives OA*OB*cos(AOB)  = R^2*cos(AOB)
where R = radius of the earth.  Having found angle AOB, the
distance between the points is R*(AOB) with AOB in radians.

To find the scalar product we need the coordinates of the
two points.  Set up a three-dimensional coordinate system
with the x-axis in the longitudinal plane of OA and the xy
plane containing the equator, and the z-axis along the earth's
axis.  With this system, the coordinates of A will be

Rcos(latA), 0, Rsin(latA)

and the coordinates of B will be

Rcos(latB)cos(lonB-lonA),Rcos(latB)sin(lonB-lonA),Rsin(latB)

The scalar product is given by xA*xB + yA*yB + zA*zB

= R^2cos(latA)cos(latB)cos(lonB-lonA)+ R^2sin(latA)sin(latB)

Dividing out R^2 will give cos(AOB)

cos(AOB)=cos(latA)cos(latB)cos(lonB-lonA)+sin(latA)sin(latB)

This gives AOB, and the great circle distance between A and
B will be
R*(AOB)   with AOB in radians.

-Doctor Anthony,  The Math Forum
Check out our web site!  http://mathforum.org/dr.math/
```
Associated Topics:
College Non-Euclidean Geometry
High School Non-Euclidean Geometry

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search