Reference to the haversine() function

Summary

haversine(<lat1>, <long1>, <lat2>, <long2>)

Returns the distance between the specified pair of coordinates.

Parameters

</tr>
ParameterDescription
lat1, long1 Expressions specifying the latitude and longitude of the first pair coordinates.
lat2, long2 Expressions specifying the latitude and longitude of the second pair of coordinates.

Description

The haversine() function returns the distance between the specified pair of coordinates.

You specify each coordinate as a pair of expressions representing latitude and longitude. The expressions may be constants or ts() expressions.

Example

In the following example, we specify a set of coordinates and the chart returns the distance in kilometers.

ts haversine