名稱

ST_IsEmpty — 測試幾何是否為空。

概要

boolean ST_IsEmpty(geometry geomA);

描述

如果此幾何為空幾何,則返回 true。如果為 true,則此幾何表示空的幾何集合、多邊形、點等。

[Note]

SQL-MM 定義 ST_IsEmpty(NULL) 的結果為 0,而 PostGIS 返回 NULL。

此方法實作了 OGC Simple Features Implementation Specification for SQL 1.1 s2.1.1.1

此方法實作了 SQL/MM 規範。SQL-MM 3: 5.1.7

此方法支援圓弧字串和曲線。

[Warning]

變更:2.0.0 在 PostGIS 的先前版本中,允許 ST_GeomFromText('GEOMETRYCOLLECTION(EMPTY)')。為了更好地符合 SQL/MM 標準,現在在 PostGIS 2.0.0 中這是非法的。

範例

SELECT ST_IsEmpty(ST_GeomFromText('GEOMETRYCOLLECTION EMPTY'));
 st_isempty
------------
 t
(1 row)

 SELECT ST_IsEmpty(ST_GeomFromText('POLYGON EMPTY'));
 st_isempty
------------
 t
(1 row)

SELECT ST_IsEmpty(ST_GeomFromText('POLYGON((1 2, 3 4, 5 6, 1 2))'));

 st_isempty
------------
 f
(1 row)

 SELECT ST_IsEmpty(ST_GeomFromText('POLYGON((1 2, 3 4, 5 6, 1 2))')) = false;
 ?column?
----------
 t
(1 row)

 SELECT ST_IsEmpty(ST_GeomFromText('CIRCULARSTRING EMPTY'));
  st_isempty
------------
 t
(1 row)