| home | contents | send comment | send link | add bookmark |

Great Circle Distance

by Stephen R. Schmitt

Origin

Latitude : ° ' '' N S
Longitude : ° ' '' E W

Destination

Latitude : ° ' '' N S
Longitude : ° ' '' E W

Results

Initial Course : ° true
Great Circle Distance : kilometers

Contents

  1. About
  2. The source code
  3. Discussion

About

This calculator computes the great circle distance between two points on the earth's surface.

The program is operated by entering two geographic points and then pressing the Calculate button. The entry form allows you to enter geographic position in degrees, minutes, and seconds. The calculator computes distance in kilometers and also computes the true bearing from the origin to the destination. All entries are cleared by pressing the Clear button.

Return to Contents


The source code

The Java Script source code for this program can be viewed by using the View|Source command of your web browser.

You may use or modify this source code in any way you find useful, provided that you agree that the author has no warranty, obligations or liability. You must determine the suitablility of this source code for your use.

Return to Contents


Discussion

A great circle is the intersection of a sphere with a plane passing through the center of the sphere. Arcs of great circles represent the shorest route between two points on the surface of the sphere. The equator is a great circle as are all meridians of longitude.

The great circle distance and bearing between two points can be calculated easily given the latitudes and longitudes of the origin and destination using the following formula from spherical trigonometry:

cos(D) = sin(lata)·sin(latb) + cos(lata)·cos(latb)·cos(lonb - lona)

cos(C) = [sin(latb) - sin(lata)·cos(D)] / [cos(lata)·sin(D)]

a - origin

b - destination

D = angular distance along path

C = true bearing from the the origin to the destination measured from north. If the value for sin(lonb - lona) is positive; otherwise, the true bearing is 360° - C.

In applying the above formula, south latitudes and west longitudes are treated as negative angles. Note: When the origin is exactly at a pole, the bearing or course to the destination cannot be determined, why?

The formulas above assume that the earth is spherical. To obtain more accurate distances, this calculator implements a method shown in chapter 10 of [1]. I've used the WGS 1984 parameters for the earth's equatorial radius and ellipsoid flattening given in [2].

References

  1. Astronomical Algorithms, Meeus
  2. NIMA TECHNICAL REPORT 8350.2, Third Edition, 3 January 2000, Department of Defense World Geodetic System 1984, Its Definition and Relationships with Local Geodetic Systems
  3. Marine Navigation: Piloting and Celestial and Electronic Navigation
  4. Dutton's Nautical Navigation
  5. The American Practical Navigator: "Bowditch"- 2002 Bicentennial Edition

Return to Contents


AbCd Classics - free on-line books


Copyright © 2004, Stephen R. Schmitt