Nombre

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

Sinopsis

geometry ST_EndPoint(geometry g);

Descripción

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.

This method implements the SQL/MM specification. SQL-MM 3: 7.1.4

This function supports 3d and will not drop the z-index.

This method supports Circular Strings and Curves.

Cambiado: 2.0.0 ya no funciona con multilinestrings de geometrías simples. En versiones anteriores de PostGIS -- una linea simple multilinestring funciona sin problemas con esta función y devuelve el punto inicial. En la version 2.0.0 simplemente devuelve NULL como con cualquier multilinestring. La antigua version era una función sin documentar, pero la gente que asumía que tenia sus datos almacenados en LINESTRING pueden experimentar este comportamiento ahora de resultado NULL en la version 2.0.

Ejemplos

End point of a LineString

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

End point of a non-LineString is NULL

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

End point of a 3D LineString

3D endpoint.

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

Devuelve el número de puntos en un valor ST_LineString o ST_CircularString.

Code
SELECT ST_EndPoint('CIRCULARSTRING(5 2,-3 2,-2 1,-4 2,6 3)'::geometry);
Output
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);
Output
POINT(2 0)
Figure
Geometry figure for visual-st-endpoint-05

Ver también

ST_PointN, ST_StartPoint