跳到主要内容

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.
备注
  • 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
└─────────────┘
开始使用 Databend Cloud
低成本
快速分析
多种数据源
弹性扩展
注册