ST_IsClosed
定义
ST_IsClosed 获取 ST_LineString 或 ST_MultiLineString,如果为闭合,则返回 1 (Oracle) 或 t (PostgreSQL);否则返回 0 (Oracle) 或 f (PostgreSQL)。
语法
sde.st_isclosed (ln1 sde.st_geometry) sde.st_isclosed (mln1 sde.st_geometry)
返回类型
布尔型
示例
测试线串
创建一个包含单一 linestring 列的 closed_linestring 表。
CREATE TABLE closed_linestring (ln1 sde.st_geometry);
INSERT 语句将两条记录插入 closed_linestring 表中。第一条记录不是闭合线串,而第二条记录是闭合线串。
Oracle
INSERT INTO CLOSED_LINESTRING VALUES ( sde.st_linefromtext ('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)', 0) ); INSERT INTO CLOSED_LINESTRING VALUES ( sde.st_linefromtext ('linestring (10.02 20.01, 11.92 35.64, 25.02 34.15, 19.15 33.94, 10.02 20.01)', 0) );
PostgreSQL
INSERT INTO closed_linestring VALUES ( sde.st_linestring ('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)', 0) ); INSERT INTO closed_linestring VALUES ( sde.st_linestring ('linestring (10.02 20.01, 11.92 35.64, 25.02 34.15, 19.15 33.94, 10.02 20.01)', 0) );
查询将返回 ST_IsClosed 函数的结果。因为第一行的线串不闭合,所以返回 0;而第二行的线串是闭合的,所以返回 1。
Oracle
SELECT sde.st_isclosed (ln1) Is_it_closed FROM CLOSED_LINESTRING; Is_it_closed 0 1
PostgreSQL
SELECT sde.st_isclosed (ln1) AS Is_it_closed FROM closed_linestring; is_it_closed f t
测试多线串
创建一个包含单一 ST_MultiLineString 列的 closed_mlinestring 表。
CREATE TABLE closed_mlinestring (mln1 sde.st_geometry);
INSERT 语句将分别插入一条闭合的和一条不闭合的 ST_MultiLineString 记录。
INSERT INTO closed_mlinestring VALUES ( sde.st_mlinefromtext ('multilinestring ((10.02 20.01, 10.32 23.98, 11.92 25.64), (9.55 23.75, 15.36 30.11))', 0) ); INSERT INTO closed_mlinestring VALUES ( sde.st_mlinefromtext ('multilinestring ((10.02 20.01, 11.92 35.64, 25.02 34.15, 19.15 33.94, 10.02 20.01), (51.71 21.73, 73.36 27.04, 71.52 32.87, 52.43 31.90, 51.71 21.73))', 0) );
查询将列出 ST_IsClosed 函数的结果。因为第一行的多线串不闭合,所以返回 0。而第二行 ln1 列中存储的多线串是闭合的,所以返回 1。如果多线串的所有线串元素都闭合,则多线串是闭合的。
Oracle
SELECT sde.st_isclosed (mln1) Is_it_closed FROM CLOSED_MLINESTRING; Is_it_closed 0 1
PostgreSQL
SELECT st_isclosed (mln1) AS Is_it_closed FROM closed_mlinestring; is_it_closed f t
7/10/2012