Name

ST_PointN — Returns the specified point N in a Linestring.

Synopsis

geometry ST_PointN(bytea Geometry, integer N);

Alias

PointN

Description

Returns the specified point N in a Linestring. The N index starts at 1. It throws an error if the incoming geometry is not a LineString or a MultiLineString.

Coordinate Dimensions
2D3DM
Spatial Standards Support
OGC SFS for SQL. 1.1 (1999)OGC SFS for SQL. 1.1.0 (2005)OGC SFS for SQL. 1.2.0 (2006))SQL-MM Part 3
2.1.6.17.2.13.17.2.11.27.2.5 - 7.3.5

Examples

SELECT ST_AsText(ST_PointN(ST_GeomFromText('LINESTRING (0 0 5, 10 10 5, 20 10 5)'),2));
--Result
POINT (10 10 5)

SELECT ST_AsText(ST_PointN(ST_GeomFromText('MULTILINESTRING ((0 0, 10 10, 20 10),(30 30, 40 40, 50 40))'),4));
--Result
POINT (30 30)

Related functions

ST_NumPoints