PostgreSQL npoints() 函数使用指南
PostgreSQL npoints() 函数计算指定的路径或多边形上的点的数量并返回。
npoints() 语法
这是 PostgreSQL npoints() 函数的语法:
npoints(geometric_type) -> integer
参数
geometric_type- 必需的。 它可以是一个 多边形
polygon或一个路径path。
返回值
PostgreSQL npoints() 函数返回通过参数指定的路径或多边形上的点的数量。
npoints() 示例
下面的语句示例展示了如何使用 PostgreSQL npoints() 计算一个开放路径 path '[(2,0),(0,0)]' 上的点的数量。
SELECT npoints(path '[(2,0),(0,0)]');
npoints
---------
2下面的语句示例展示了如何使用 PostgreSQL npoints() 计算一个闭合路径 path '((2,0),(0,0))' 上的点的数量。
SELECT npoints(path '((2,0),(0,0))');
npoints
--------
2下面的语句示例展示了如何使用 PostgreSQL npoints() 计算一个多边形 polygon '(0,0),(2,2),(4,0)' 上的点的数量。
SELECT npoints(polygon '(0,0),(2,2),(4,0)');
npoints
---------
3