This script calculates great-circle distances between the two points – that is, the shortest distance over the earth’s surface – using the ‘Haversine’ formula. It assumes a spherical earth, ignoring ellipsoidal effects – which is accurate enough for most purposes… – giving an ‘as-the-crow-flies’ distance between the two points (ignoring any hills!). It can also be calculated with the Vincenty formula, which includes ellipsoidal effects.
Enter the co-ordinates into the text boxes to try it out. It accepts a variety of formats:
Lat 1: Long 1:
Lat 2: Long 2:
And you can see it on a map (thanks to the nice guys at Google Maps)
This is the initial bearing which if followed in a straight line along a great-circle arc (orthodrome) will take you from the start point to the end point; in general, the bearing you are following will have varied by the time you get to the end point (if you were to go from say 35°N,45°E (Baghdad) to 35°N,135°E (Osaka), you would start on a bearing of 60° and end up on a bearing of 120°!).
For final bearing, simply take the initial bearing from the end point to the start point and reverse it (using θ = (θ+180) % 360).
Just as the initial bearing may vary from the final bearing, the midpoint may not be located half-way between latitudes/longitudes; the midpoint between 35°N,45°E and 35°N,135°E is around 45°N,90°E.
Given a start point, initial bearing, and distance, this will calculate the destination point and final bearing travelling along a (shortest distance) great circle arc.