ArcGIS Server Banner

ST_IsClosed

ST_IsClosed

Release 9.3 E-mail This TopicPrintable VersionGive Us feedback
Note: This topic was updated for 9.3.1.

Definition

ST_IsClosed takes an ST_Linestring or ST_MultiLineString and returns 1 (Oracle) or t (PostgreSQL) if it is closed; otherwise, it returns 0 (Oracle) or f (PostgreSQL).

Syntax

Oracle

sde.st_isclosed (ln1 sde.st_geometry)
sde.st_isclosed (mln1 sde.st_geometry)

PostgreSQL

st_isclosed (ln1 st_geometry)
st_isclosed (mln1 st_geometry)

Return type

Boolean

Example

The closed_linestring table is created with a single linestring column.

Oracle

CREATE TABLE closed_linestring (ln1 sde.st_geometry);

PostgreSQL

CREATE TABLE closed_linestring (ln1 st_geometry);

The INSERT statements insert two records into the closed_linestring table. The first record is not a closed linestring, while the second is.

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 (
st_linestring ('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)', 0)
);

INSERT INTO closed_linestring VALUES (
st_linestring ('linestring (10.02 20.01, 11.92 35.64, 25.02 34.15, 19.15 33.94, 10.02 20.01)', 0)
);

The query returns 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.

Oracle

SELECT sde.st_isclosed (ln1) Is_it_closed
FROM closed_linestring;

Is_it_closed

0
1

PostgreSQL

SELECT st_isclosed (ln1) AS Is_it_closed
FROM closed_linestring;

is_it_closed

f
t

The closed_mlinestring table is created with a single ST_MultiLineString column.

CREATE TABLE closed_mlinestring (mln1 st_geometry);

The INSERT statements insert an ST_MultiLineString record that is not closed and another that is.

Oracle

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)
);

PostgreSQL

INSERT INTO closed_mlinestring VALUES (
st_multilinestring ('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 (
st_multilinestring ('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)
);

The query lists the results of the ST_IsClosed function. The first row returns 0 because the multilinestring is not closed. The second row returns 1 because the multilinestring stored in the ln1 column is closed. A multilinestring is closed if all its linestring elements are closed.

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

See Also

  • An overview of SQL functions used with ST_Geometry types