ArcGIS Server Banner

ST_InteriorRingN

ST_InteriorRingN

Release 9.3 E-mail This TopicPrintable VersionGive Us feedback

Definition

St_InteriorRing returns the nth interior ring of a polygon as an ST_LineString.

The order of the rings cannot be predefined since the rings are organized according to the rules defined by the internal geometry verification routines and not by geometric orientation. If the index exceeds the number of interior rings possessed by a polygon, a null value is returned.

Syntax

Oracle

sde.st_interiorringn (pl1 sde.st_polygon, INDEX integer)

PostgreSQL

st_interiorringn (pl1 st_polygon, index integer)

Return type

ST_LineString

Example

Create a table, sample_polys, and add a record.

Oracle

CREATE TABLE sample_polys (id integer, geometry sde.st_geometry);

INSERT INTO sample_polys VALUES (
1,
sde.st_polygon ('polygon ((40 120, 90 120, 90 150, 40 150, 40 120), (50 130, 60 130, 60 140, 50 140, 50 130), 
(70 130, 80 130, 80 140, 70 140, 70 130))', 0)
);

PostgreSQL

CREATE TABLE sample_polys (id integer, geometry st_geometry);

INSERT INTO sample_polys VALUES (
1,
st_polygon ('polygon ((40 120, 90 120, 90 150, 40 150, 40 120), (50 130, 60 130, 60 140, 50 140, 50 130), 
(70 130, 80 130, 80 140, 70 140, 70 130))', 0)
);

Select the ID and the geometry of the interior ring.

Oracle

SELECT id, sde.st_astext (sde.st_interiorringn (geometry, 2)) Interior_Ring
FROM sample_polys; 

ID INTERIOR_RING 

1  LINESTRING (70.00000000 130.00000000, 70.00000000 140.00000000, 80.00000000 140.00000000, 80.00000000 130.00000000, 70.00000000 130.00000000)

PostgreSQL

SELECT id, st_astext (st_interiorringn (geometry, 2)) AS Interior_Ring
FROM sample_polys; 

id interior_ring

1  LINESTRING (70 130, 70 140, 80 140, 80 130, 70 130)

See Also

  • An overview of SQL functions used with ST_Geometry types