Nome

ST_NPoints — Returns the number of points (vertices) in a geometry.

Sinossi

integer ST_NPoints(geometry g1);

Descrizione

Return the number of points in a geometry. Works for all geometries.

Miglioramento: nella versione 2.0.0 è stato introdotto il supporto per le superfici poliedriche.

[Nota]

Prior to 1.3.4, this function crashes if used with geometries that contain CURVES. This is fixed in 1.3.4+

Questa funzione supporta il 3d e non distrugge gli z-index.

Questo metodo supporta le Curve e le Circular String.

Questa funzione supporta le Polyhedral Surface.

Esempi

Count the points in a 2D LineString.

Code
SELECT ST_NPoints('LINESTRING(77.29 29.07,77.42 29.26,77.27 29.31,77.29 29.07)');
Output
st_npoints
------------
          4
(1 row)

Count the points in a 3D LineString.

Code
SELECT ST_NPoints('LINESTRING(77.29 29.07 1,77.42 29.26 0,77.27 29.31 -1,77.29 29.07 3)');
Output
st_npoints
------------
          4
(1 row)

Si veda anche

ST_NumPoints