ST_IsClosed takes a linestring or multilinestring and returns 1 (TRUE) if it is closed; otherwise it returns 0 (FALSE).
Syntax
db2gse.ST_IsClosed(c db2gse.ST_Curve)
db2gse.ST_IsClosed(mc db2gse.ST_MultiCurve)
Return type
Integer
Examples
The following CREATE TABLE statement creates the CLOSED_LINESTRING table, which has a single linestring column.
CREATE TABLE CLOSED_LINESTRING (ln1 db2gse.ST_LineString)
The following INSERT statements insert two records into the CLOSED_LINESTRING table. The first record is not a closed linestring, while the second is.
INSERT INTO CLOSED_LINESTRING VALUES(db2gse.ST_LineFromText('linestring (10.02 20.01,10.32 23.98,11.92 25.64)', db2gse.coordref()..srid(0))) INSERT INTO CLOSED_LINESTRING VALUES(db2gse.ST_LineFromText('linestring (10.02 20.01,11.92 35.64,25.02 34.15, 19.15 33.94,10.02 20.01)', db2gse.coordref()..srid(0)))
The following SELECT statement and the corresponding result set shows the results of the ST_IsClosed function. The first row returns a 0 because the linestring is not closed, while the second row returns a 1 because the linestring is closed.
SELECT db2gse.ST_IsClosed(ln1) "Is it closed" FROM CLOSED_LINESTRING Is it closed ------------ 0 1 2 record(s) selected.
The following CREATE TABLE statement creates the CLOSED_MULTILINESTRING table, which has a single multilinestring column.
CREATE TABLE CLOSED_MULTILINESTRING (mln1 db2gse.ST_MultiLineString)
The following INSERT statements insert two records into CLOSED_MULTILINESTRING, a multilinestring record that is not closed and another that is.
INSERT INTO CLOSED_MULTILINESTRING VALUES(db2gse.ST_MLineFromText('multilinestring ((10.02 20.01,10.32 23.98,11.92 25.64), (9.55 23.75,15.36 30.11))', db2gse.coordref()..srid(0))) INSERT INTO CLOSED_MULTILINESTRING VALUES(db2gse.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))', db2gse.coordref()..srid(0)))
The following SELECT statement and the corresponding result set shows the results of the ST_IsClosed function. The first row returns 0 because the multilinestring is not closed, while the second row returns 1 because the multilinestring is closed. A multilinestring is closed if all of its linestring elements are closed.
SELECT db2gse.ST_IsClosed(mln1) "Is it closed" FROM CLOSED_MULTILINESTRING Is it closed ------------ 0 1 2 record(s) selected.