haversine_distance_km
haversine_distance_km(lat1: float64, lon1: float64, lat2: float64, lon2: float64) -> float64
Computes the great circle approximate distance between two latitude/longitude
coordinates, using the haversine formula. Arguments are in decimal degrees,
and the result unit is kilometers, and is approximate to within about 1%
because it does not compensate for the full shape distortion of the Earth.
The argument order is lat1, lon2, lat2, lon2, where each latitude must
be in the range -90.0 to 90.0 degrees, and each longitude must be in the range
-180.0 to 180.0 degrees. Invalid input values result in a null output.
Domain
This is a scalar function (calculates a single output value for a single input row).
Categories
Examples
Make a new column distance which computes the approximate distance in kilometers
between San Mateo, CA (37.563 N, 122.326 W) and Zurich, CH (47.377 N, 8.542 E), which
is about 9386 kilometers.