Skip to main content
Version: current [25.x]

Categories: Geospatial

GEO_DISTANCE

Returns the distance between two points in meters.

Syntax

GEO_DISTANCE(lat1 float, lon1 float, lat2 float, lon2 float) → double

  • lat1: The latitude of the source location in degrees.
  • lon1: The longitude of the source location in degrees.
  • lat2: The latitude of the destination location in degrees.
  • lon2: The longitude of the destination location in degrees.

Examples

Determine the distance from Venice, Italy to Paris, France in meters.
SELECT GEO_DISTANCE(CAST(45.4408 AS FLOAT), CAST(12.3155 AS FLOAT), CAST(48.8566 AS FLOAT), CAST(2.3522 AS FLOAT))
-- 842876.0300143225

Usage Notes

The parameters to this function can only be the FLOAT data type. You must CAST other data types to FLOAT. This function calculates the result using the Haversine distance algorithm.