名称

ST_IsRing — 测试一个 LineString 是否闭合且简单。

概要

boolean ST_IsRing(geometry g);

描述

如果此 LINESTRING 既是 ST_IsClosed (ST_StartPoint(g) ~= ST_Endpoint(g)) 又是 ST_IsSimple (不自相交),则返回 TRUE

此方法实现了 OGC 简单要素 SQL 实现规范 1.1 版 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)