ArcGIS Server Banner

ST_IsRing

ST_IsRing

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

Definition

ST_IsRing takes an ST_LineString and returns 1 (Oracle) or t (PostgreSQL) if it is a ring (for example, the ST_LineString is closed and simple); otherwise, it returns 0 (Oracle) or f (PostgreSQL).

Syntax

Oracle

sde.st_isring (ln1 sde.st_geometry)

PostgreSQL

st_isring (ln1 st_geometry)

Return type

Boolean

Example

The ring_linestring table is created with a single ST_LineString column, ln1.

Oracle

CREATE TABLE ring_linestring (ln1 sde.st_geometry);

PostgreSQL

CREATE TABLE ring_linestring (ln1 st_geometry);

The INSERT statements insert three linestrings into the ln1 column. The first row contains a linestring that's not closed and isn't a ring. The second row contains a closed and simple linestring that is a ring. The third row contains a linestring that is closed but not simple because it intersects its own interior. It is also not a ring.

Oracle

INSERT INTO ring_linestring VALUES (
sde.st_linefromtext ('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)', 0)
);

INSERT INTO ring_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)
);

INSERT INTO ring_linestring VALUES (
sde.st_linefromtext ('linestring (15.47 30.12, 20.73 22.12, 10.83 14.13,
16.45 17.24, 21.56 13.37, 11.23 22.56, 19.11 26.78, 15.47 30.12)', 0)
);

PostgreSQL

INSERT INTO ring_linestring VALUES (
st_linestring ('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)', 0)
);

INSERT INTO ring_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)
);

INSERT INTO ring_linestring VALUES (
st_linestring ('linestring (15.47 30.12, 20.73 22.12, 10.83 14.13,
16.45 17.24, 21.56 13.37, 11.23 22.56, 19.11 26.78, 15.47 30.12)', 0)
);

The query returns the results of the function. The first row returns 0 because the linestrings aren't rings while the second and third rows return 1 because they are rings.

Oracle

SELECT sde.st_isring (ln1) Is_it_a_ring
FROM ring_linestring;

Is_it_a_ring

0
1
1

PostgreSQL

SELECT st_isring (ln1) AS Is_it_a_ring
FROM ring_linestring;

Is_it_a_ring

f
t
t

See Also

  • An overview of SQL functions used with ST_Geometry types