GREAT_CIRCLE

The following section describes the syntax and usage of the GREAT_CIRCLE function in ActivityInfo.

Description

The GREAT_CIRCLE function finds the distance, in kilometers, between two geographic points.

Syntax

GREAT_CIRCLE(latitude1, longitude1, latitude2, longitude2)

Argument Required Description
latitude1
Yes

The latitude, in degrees, of the first point.


longitude1
Yes

The longitude, in degrees, of the second point.


latitude2
Yes The latitude, in degrees, of the second point.
longitude2
Yes The longitude, in degrees, of the second point.

Result

Returns the number kilometers between the two points.

Examples

The following formula finds the distance between two geographic point fields in the same record, assuming that the form has a field with the code origin and a second geographic point with the code destination.

GREAT_CIRCLE(origin.latitude, origin.longitude, 
             destination.latitude, destination.longitude)
Click to copy

The next formula finds the distance between a geographic point field with the code location, and the provincial capital Bukavu, which is located at 2.5123° S, 28.8480° E. Notice that in decimal degrees, the negative sign is used for the southern and western hemispheres.

GREAT_CIRCLE(location.latitude, location.longitude,
             -2.5123, +28.8480)
Click to copy

Remarks

The distance between the two points is calculated using the Haversine Formula, which is an approximation that assumes the earth is perfect sphere. This can result in an error of up to 0.5%, depending on how far north or south the points are from the equator.