名称

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

大纲

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。

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

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

示例

线串(LineString)端点

Code
SELECT ST_EndPoint('LINESTRING(1 1,2 2,3 3)'::geometry);
栅格输出
POINT(3 3)
Figure
Geometry figure for visual-st-endpoint-01

非线串终止点为 NULL

Code
SELECT ST_EndPoint('POINT(1 1)'::geometry) IS NULL AS is_null;
栅格输出
t

3D 线串(LineString)端点

3D endpoint.

Code
SELECT ST_EndPoint('LINESTRING(1 1 2,1 2 3,0 0 5)');
栅格输出
POINT(0 0 5)
Figure
Geometry figure for visual-st-endpoint-03

圆弧 的端点

Code
SELECT ST_EndPoint('CIRCULARSTRING(5 2,-3 2,-2 1,-4 2,6 3)'::geometry);
栅格输出
POINT(6 3)
Figure
Geometry figure for visual-st-endpoint-04

End point of a NURBSCurve

Code
SELECT ST_EndPoint('NURBSCURVE(2, (0 0, 1 1, 2 0))'::geometry);
栅格输出
POINT(2 0)
Figure
Geometry figure for visual-st-endpoint-05

相关信息

ST_PointN, ST_StartPoint