"EarthDistance" computes the distance between two points on the
surface of a sphere representing the earth .
Latitude is measured relative to the equator (north is positive and south is negative).
Longitude is measured relative to the Greenwich meridian (east is positive
and west is negative).
Following constants and formulas are used for the subroutine
radius of the earth = 6370 km
pi / 2 = 1.570796326794897
Spherical law of Cosines
cos C = cos A * cos B + sin A * sin B * cos c
(A, B, and C : side of triangle, and c : angle))
| 7.8 | EARTHDISTANCE | |||||||
| Purpose: | ||||||||
| Compute the distance between two points on the earth from spherical coordinates. | ||||||||
| Calling Sequence: | ||||||||
| Call EARTHDISTANCE(LAT1, LONG1, LAT2, LONG2, DISTANCE) | ||||||||
| Declarations: | ||||||||
| DOUBLE PRECISION | LAT1, LONG1, LAT2, LONG2 | |||||||
| DOUBLE PRECISION | DISTANCE | |||||||
| Argument Description: | ||||||||
| LAT1 | (Input) | Latitude for first point, radians. | ||||||
| LONG1 | (Input) | longitude for first points, radians. | ||||||
| LAT2 | (Input) | Latitude for second point, radians. | ||||||
| LONG2 | (Input) | longitude for second points, radians. | ||||||
| DISTANCE | (Output) | Distance along the surface of the earth between the two points, km | ||||||
| Remarks: | ||||||||
| This subroutine uses a sphere, with radius=6370km, to approximate the earth | ||||||||
| Normally, latitude is negative in the Southern Hemisphere, and longitude is negative in the Western Hemisphere. Signs are not necessary when both points are in the same quadrant. | ||||||||