Nazwa

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

Streszczenie

integer ST_NPoints(geometry g1);

Opis

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

Ulepszenie: 2.0.0 wprowadzono wsparcie dla powierzchni wielościanowych

[Uwaga]

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

This function supports 3d and will not drop the z-index.

This method supports Circular Strings and Curves.

This function supports Polyhedral surfaces.

Przykłady

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)

Zobacz także

ST_NumPoints