名称

ST_IsRing — 检测线串是闭合的还是简单的。

大纲

boolean ST_IsRing(geometry g);

描述

Returns TRUE if this LINESTRING is both ST_IsClosed (ST_StartPoint(g) ~= ST_EndPoint(g)) and ST_IsSimple (does not self intersect).

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

该方法实现了SQL/MM规范。 SQL-MM 3: 7.1.6

[注意]

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

示例

Code
SELECT ST_IsRing(geom), ST_IsClosed(geom), ST_IsSimple(geom)
FROM (SELECT 'LINESTRING(0 0,0 1,1 1,1 0,0 0)'::geometry AS geom) AS foo;
栅格输出
st_isring | st_isclosed | st_issimple
-----------+-------------+-------------
 t         | t           | t
(1 row)
Figure
Geometry figure for visual-st-isring-01
Code
SELECT ST_IsRing(geom), ST_IsClosed(geom), ST_IsSimple(geom)
FROM (SELECT 'LINESTRING(0 0,0 1,1 0,1 1,0 0)'::geometry AS geom) AS foo;
栅格输出
st_isring | st_isclosed | st_issimple
-----------+-------------+-------------
 f         | t           | f
(1 row)
Figure
Geometry figure for visual-st-isring-02