名称

ST_IsClosed — 测试 LineStrings 的起点和终点是否重合。 对于多面体表面测试是否闭合(实心)。

大纲

boolean ST_IsClosed(geometry g);

描述

如果 LINESTRING 的起点和终点重合,则返回TRUE。对于多面体曲面,测试曲面是面状的(开放的)还是体状的(闭合的)。

此方法实现了 SQL 1.1 的 OGC 简单功能规范。

该方法实现了SQL/MM规范。 SQL-MM 3: 7.1.5, 9.3.3

[注意]

SQL-MM 定义了 ST_IsClosed(NULL) 的结果为 0,而 PostGIS 返回 NULL

该函数支持 3d 并且不会丢失 z-index。

此方法支持圆形字符串和曲线。

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

该函数支持多面体曲面。

线串和点的示例

Code
SELECT ST_IsClosed('LINESTRING(0 0,1 1)'::geometry);
栅格输出
f
Figure
Geometry figure for visual-st-isclosed-01
Code
SELECT ST_IsClosed('LINESTRING(0 0,0 1,1 1,0 0)'::geometry);
栅格输出
t
Figure
Geometry figure for visual-st-isclosed-02
Code
SELECT ST_IsClosed('MULTILINESTRING((0 0,0 1,1 1,0 0),(0 0,1 1))'::geometry);
栅格输出
f
Figure
Geometry figure for visual-st-isclosed-03
Code
SELECT ST_IsClosed('POINT(0 0)'::geometry);
栅格输出
t
Code
SELECT ST_IsClosed('MULTIPOINT((0 0),(1 1))'::geometry);
栅格输出
t

多面体曲面示例

This example uses a cube.

Code
SELECT ST_IsClosed('POLYHEDRALSURFACE( ((0 0 0,0 0 1,0 1 1,0 1 0,0 0 0)),
((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,1 0 1,0 0 1,0 0 0)),
((1 1 0,1 1 1,1 0 1,1 0 0,1 1 0)),
((0 1 0,0 1 1,1 1 1,1 1 0,0 1 0)),((0 0 1,1 0 1,1 1 1,0 1 1,0 0 1)) )');
栅格输出
t
Figure
Geometry figure for visual-st-isclosed-06

This example uses the same cube with one side missing.

Code
SELECT ST_IsClosed('POLYHEDRALSURFACE( ((0 0 0,0 0 1,0 1 1,0 1 0,0 0 0)),
       ((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,1 0 1,0 0 1,0 0 0)),
       ((1 1 0,1 1 1,1 0 1,1 0 0,1 1 0)),
       ((0 1 0,0 1 1,1 1 1,1 1 0,0 1 0)) )');
栅格输出
f
Figure
Geometry figure for visual-st-isclosed-07

相关信息

ST_IsRing