ST_NPoints

更新时间:
复制 MD 格式

Returns the total number of points (vertices) in a meshgeom or sfmesh object.

Syntax

int4 ST_NPoints(meshgeom geom);
int4 ST_NPoints(sfmesh sfmesh);

Parameters

ParameterDescription
geomThe meshgeom object.
sfmeshThe sfmesh object.

Usage notes

ST_NPoints counts every vertex declared in the VERTEX constructor. The return type is int4.

Examples

The following example counts the points in a MESHGEOM object that has four vertices.

SELECT ST_NPoints('MESHGEOM(PATCH(INDEXSURFACE(VERTEX(0 0 2,0 10 3,10 10 1,10 0 1), INDEX((0,1,2),(1,2,3)))))'::meshgeom);

Output:

 st_npoints
------------
 4