名称

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)

另请参见

ST_IsClosedST_IsSimpleST_StartPointST_EndPoint