ST_DISTANCE_SPHERE (Lakehouse v2)
Returns the spherical distance between two points in meters.
Analyze Syntax
Section titled “Analyze Syntax”func.st_distance_sphere(<lng1>, <lat1>, <lng2>, <lat2>)Analyze Examples
Section titled “Analyze Examples”func.st_distance_sphere(-73.9857, 40.7484, -0.1278, 51.5074)
┌───────────┐│ 5570222.5 │└───────────┘SQL Syntax
Section titled “SQL Syntax”ST_DISTANCE_SPHERE(<lng1>, <lat1>, <lng2>, <lat2>)SQL Examples
Section titled “SQL Examples”Distance in meters between New York City and London:
SELECT ST_DISTANCE_SPHERE(-73.9857, 40.7484, -0.1278, 51.5074) AS distance_meters;
┌─────────────────┐│ distance_meters │├─────────────────┤│ 5570222.50 │└─────────────────┘Distance in kilometers (divide meters by 1000):
SELECT ST_DISTANCE_SPHERE(-73.9857, 40.7484, -0.1278, 51.5074) / 1000 AS distance_km;
┌─────────────┐│ distance_km │├─────────────┤│ 5570.22 │└─────────────┘Distance in miles (divide meters by 1609.344):
SELECT ST_DISTANCE_SPHERE(-73.9857, 40.7484, -0.1278, 51.5074) / 1609.344 AS distance_miles;
┌────────────────┐│ distance_miles │├────────────────┤│ 3461.02 │└────────────────┘