名稱

ST_IsRing — 測試 LineString 是否為封閉且簡單。

概要

boolean ST_IsRing(geometry g);

描述

若此 LINESTRING 同時符合 ST_IsClosed (ST_StartPoint(g) ~= ST_Endpoint(g)) 與 ST_IsSimple (不自相交),則傳回 TRUE

此方法實作了 OGC Simple Features Implementation Specification for 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)