haversine
relationalai.semantics.std.math
haversine( lat1: NumberValue, lon1: NumberValue, lat2: NumberValue, lon2: NumberValue, radius: NumberValue = 1.0,) -> ExpressionCompute the haversine distance between two points on a sphere.
The haversine formula determines the great-circle distance between two points on a sphere given their longitudes and latitudes.
Parameters
Section titled “Parameters”
(lat1NumberValue) - Latitude of the first point in radians.
(lon1NumberValue) - Longitude of the first point in radians.
(lat2NumberValue) - Latitude of the second point in radians.
(lon2NumberValue) - Longitude of the second point in radians.
(radiusNumberValue, default:1.0) - Radius of the sphere. Default: 1.0.
Returns
Section titled “Returns”Expression- AnExpressioncomputing the haversine distance. ReturnsFloat.
Examples
Section titled “Examples”Calculate distance between two points on Earth (radius ~6371 km):
>>> math.haversine(lat1, lon1, lat2, lon2, radius=6371)