Reference to the haversine() function

Summary

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

Returns the distance between the specified pair of coordinates.

Parameters

ParameterDescription
lat1, long1 tsExpressions specifying the latitude and longitude of the first pair coordinates. Either expression can describe a constant or a time series of values.
lat2, long2 tsExpressions specifying the latitude and longitude of the second pair of coordinates. Either expression can describe a constant or a time series of values.

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 tsExpressions.

Example

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

ts haversine