Skip to main content

ST_DISTANCE

Introduced or updated: v1.2.555

Returns the minimum Euclidean distance between two GEOMETRY objects.

Syntax

ST_DISTANCE(<geometry1>, <geometry2>)

Arguments

ArgumentsDescription
<geometry1>The argument must be an expression of type GEOMETRY and must contain a Point.
<geometry2>The argument must be an expression of type GEOMETRY and must contain a Point.
note
  • Returns NULL if one or more input points are NULL.
  • The function reports an error if the two input GEOMETRY objects have different SRIDs.

Return Type

Double.

Examples

SELECT
ST_DISTANCE(
TO_GEOMETRY('POINT(0 0)'),
TO_GEOMETRY('POINT(1 1)')
) AS distance

┌─────────────┐
│ distance │
├─────────────┤
1.414213562
└─────────────┘
Explore Databend Cloud for FREE
Low-cost
Fast Analytics
Easy Data Ingestion
Elastic Scaling
Try it today