GEODISTANCE_HAVERSINE Function

Computes the distance between two geographical points. This formula provides greater accuracy, particularly for shorter distances.

Category: Information and Conversion
Note: This function provides better accuracy than the GEODISTANCE_COSINE function, but is slower.

Syntax

GEODISTANCE_HAVERSINE(<lat1, lon1, lat2, lon2>)

Required Arguments

lat1

latitude for first location, in decimal degrees. South latitudes are negative.

lon1

longitude for first location, in decimal degrees. East longitudes are positive.

lat2

latitude for second location, in decimal degrees. South latitudes are negative.

lon2

longitude for second location, in decimal degrees. East longitudes are positive.

Details

The GEODISTANCE_HAVERSINE function is used to compute the distance between two geographical points.
Note: Each point is represented using latitude and longitude in decimal degrees. South latitudes are negative and east longitudes are positive. The function returns -1 when there is an error.

Example

geodistance_haversine(21.349017, -45.566906, -35.203839, 19.996602)