Skip to main content

GREAT_CIRCLE_DISTANCE

Returns the great-circle distance in meters between two points on a sphere. The points are specified by longitude and latitude in degrees.

Syntax

GREAT_CIRCLE_DISTANCE(<lon1>, <lat1>, <lon2>, <lat2>)

Arguments

ArgumentsDescription
<lon1>Longitude of the first point in degrees.
<lat1>Latitude of the first point in degrees.
<lon2>Longitude of the second point in degrees.
<lat2>Latitude of the second point in degrees.

Return Type

Float32.

Examples

SELECT GREAT_CIRCLE_DISTANCE(55.755831, 37.617673, -55.755831, -37.617673) AS distance;

╭────────────╮
│ distance │
├────────────┤
14128353.0
╰────────────╯
Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today