Name

ST_NumPoints — Returns the number of Points in a LineString

Synopsis

integer ST_NumPoints(bytea Geometry);

Alias

NumPoints, ST_NPoints, NPoints

Description

Returns the number of Points in a LineString

[Note]

If the input Geometry is not a LineString, Jaspa also counts the number of points, instead of returning Null as specified in SQL-MM.

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.4

Examples

SELECT ST_NumPoints(ST_GeomFromText('LINESTRING (0 0, 10 10, 20 10)'));
--Result
3

SELECT ST_NumPoints(ST_GeomFromText('MULTILINESTRING ((0 0, 10 10, 20 10),(30 30, 40 40, 50 40))'));
--Result
6

SELECT ST_NPoints(ST_GeomFromText('MULTIPOINT (0 0, 10 10, 20 10)'));
--Result
3

Related functions

ST_PointN