Name

ST_EndPoint — Returns the last point of a LineString, CircularLineString, or NURBSCurve.

Synopsis

geometry ST_EndPoint(geometry g);

描述

Returns the last point of a LINESTRING, CIRCULARLINESTRING, or NURBSCURVE geometry as a POINT. Returns NULL if the input is not a LINESTRING, CIRCULARLINESTRING, or NURBSCURVE.

该方法实现了SQL/MM规范。 SQL-MM 3: 7.1.4

该函数支持 3d 并且不会丢失 z-index。

此方法支持圆形字符串和曲线。

[Note]

更改:2.0.0 不再适用于单个几何体 MultiLineStrings。 在旧版本的 PostGIS 中,单行 MultiLineString 可以使用此函数并返回终点。 在 2.0.0 中,它像任何其他 MultiLineString 一样返回 NULL。 旧的行为是一个未记录的功能,但是那些假设将数据存储为 LINESTRING 的人可能会在 2.0.0 中遇到这些返回 NULL 的情况。

示例

线串(LineString)端点

SELECT ST_AsText(ST_EndPoint('LINESTRING(1 1, 2 2, 3 3)'::geometry));
POINT(3 3)

非线串终止点为 NULL

SELECT ST_EndPoint('POINT(1 1)'::geometry) IS NULL AS is_null;
t

3D 线串(LineString)端点

3D endpoint.

SELECT ST_AsEWKT(ST_EndPoint('LINESTRING(1 1 2, 1 2 3, 0 0 5)'));
POINT(0 0 5)

圆弧 的端点

SELECT ST_AsText(ST_EndPoint('CIRCULARSTRING(5 2,-3 2, -2 1, -4 2, 6 3)'::geometry));
POINT(6 3)

End point of a NURBSCurve

SELECT ST_AsText(ST_EndPoint('NURBSCURVE(2, (0 0, 1 1, 2 0))'::geometry));
POINT(2 0)

相关信息

ST_PointN, ST_StartPoint