Name

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

Synopsis

boolean ST_IsRing(geometry g);

描述

返回 TRUE,当LINESTRING 同时满足 ST_IsClosed(即 ST_StartPoint(g) ~= ST_Endpoint(g))和 ST_IsSimple(即不自交)时。

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

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

[Note]

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

示例

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)

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)