GREAT_CIRCLE

Description

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

Usage

GREAT_CIRCLE(latitude1, longitude1, latitude2, longitude2)

Arguments

Argument Type Required Description
latitude1 Number Yes The latitude, in degrees, of the first point.
longitude1 Number Yes The longitude, in degrees, of the first point.
latitude2 Number Yes The latitude, in degrees, of the second point.
longitude2 Number Yes The longitude, in degrees, of the second point.

Result

Returns the number kilometers between the two points.

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.

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)

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)

The GREAT_CIRLCE function calculates the distance in kilometers. To calculate the distance in miles, you can use the conversion factor 0.621371:

GREAT_CIRCLE(origin.latitude, origin.longitude, 
             destination.latitude, destination.longitude) * 0.621371
Next item
CEIL