Name

ST_NPoints — 返回几何体中的点(顶点)数。

Synopsis

integer ST_NPoints(geometry g1);

描述

返回几何图形中的点数。适用于所有几何体。

增强:引入了对多面体曲面的2.0.0支持。

[Note]

在1.3.4之前的版本中,如果与包含曲线的几何体一起使用,此函数会崩溃。这在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.

示例

SELECT ST_NPoints(ST_GeomFromText('LINESTRING(77.29 29.07,77.42 29.26,77.27 29.31,77.29 29.07)'));
--result
4

--Polygon in 3D space
SELECT ST_NPoints(ST_GeomFromEWKT('LINESTRING(77.29 29.07 1,77.42 29.26 0,77.27 29.31 -1,77.29 29.07 3)'))
--result
4

另请参阅

ST_NumPoints