ST_NumPoints

Determines the number of points (also called vertices) that make up a geometry or geometry collection.

Syntax

ST_NumPoints(geo);
geo
The input geometry or geometry collection.

Type: VARCHAR(ANY)

Returns

A value of type INT4 that represents the number of vertices of the input geometry.

Examples

SELECT inza..ST_NumPoints(inza..ST_WKTToSQL('POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))'));
 
ST_NUMPOINTS
--------------
5
(1 row)
SELECT inza..ST_NumPoints(inza..ST_WKTToSQL('GeometryCollection(POINT (10 10), POINT (30 30), LINESTRING (15 15, 20 20))'));
 
ST_NUMPOINTS
--------------
4
(1 row)
SELECT inza..ST_NumPoints(inza..ST_WKTToSQL('POLYGON ((0 0, 110 0, 110 110, 0 110, 0 0), (10 10, 10 20, 20 20, 20 15, 10 10))'));
 
ST_NUMPOINTS
--------------
10
(1 row)