ST_Endpoint function
The ST_Endpoint function takes a curve as an input parameter and returns the point that is the last point of the curve. The resulting point is represented in the spatial reference system of the specified curve.
If the specified curve is null or is empty, then null is returned.
Syntax
Parameter
- curve
- A value of type ST_Curve that represents the geometry from which the last point is returned.
Return type
ST_Point
Example
The SELECT statement finds the
endpoint of each of the geometries in the SAMPLE_LINES table.
CREATE TABLE sample_lines(id INTEGER, line ST_Linestring)
INSERT INTO sample_lines VALUES
(1, ST_LineString('linestring (10 10, 5 5, 0 0, 10 0, 5 5, 0 10)', 0) )
INSERT INTO sample_lines VALUES
(2, ST_LineString('linestring z (0 0 4, 5 5 5, 10 10 6, 5 5 7)', 0) )
SELECT id, CAST(ST_AsText(ST_EndPoint(line)) as VARCHAR(50)) Endpoint
FROM sample_lines
Results:
ID ENDPOINT
----------- --------------------------------------------------
1 POINT (0 10)
2 POINT Z(5 5 7)