跳到主要内容

ST_POINTN

Introduced or updated: v1.2.458

Returns a Point at a specified index in a LineString.

Syntax

ST_POINTN(<geometry>, <index>)

Arguments

ArgumentsDescription
<geometry>The argument must be an expression of type GEOMETRY that represents a LineString.
<index>The index of the Point to return.
备注

The index is 1-based, and a negative index is uesed as the offset from the end of LineString. If index is out of bounds, the function returns an error.

Return Type

Geometry.

Examples

SELECT
ST_POINTN(
ST_GEOMETRYFROMWKT(
'LINESTRING(1 1, 2 2, 3 3, 4 4)'
),
1
) AS pipeline_pointn;

┌─────────────────┐
│ pipeline_pointn │
├─────────────────┤
POINT(1 1)
└─────────────────┘

SELECT
ST_POINTN(
ST_GEOMETRYFROMWKT(
'LINESTRING(1 1, 2 2, 3 3, 4 4)'
),
-2
) AS pipeline_pointn;

┌─────────────────┐
│ pipeline_pointn │
├─────────────────┤
POINT(3 3)
└─────────────────┘
开始使用 Databend Cloud
低成本
快速分析
多种数据源
弹性扩展
注册