暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

PostgreSQL npoints() 函数

原创 游湖 2023-01-27
588

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
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论