HAVERSINE distance in BigQuery?
问题 I'm looking for a way to get HAVERSINE() in BigQuery. For example, how to get the closest weather stations to an arbitrary point? 回答1: 2019 update: BigQuery now has a native ST_DISTANCE() function, which is more accurate than Haversine. For example: #standardSQL CREATE TEMP FUNCTION RADIANS(x FLOAT64) AS ( ACOS(-1) * x / 180 ); CREATE TEMP FUNCTION RADIANS_TO_KM(x FLOAT64) AS ( 111.045 * 180 * x / ACOS(-1) ); CREATE TEMP FUNCTION HAVERSINE(lat1 FLOAT64, long1 FLOAT64, lat2 FLOAT64, long2