ArcGIS Server Banner

ST_ExteriorRing

ST_ExteriorRing

Release 9.3 E-mail This TopicPrintable VersionGive Us feedback

Definition

ST_ExteriorRing returns the exterior ring of a polygon as a linestring.

Syntax

Oracle

sde.st_exteriorring (pl1 sde.st_geometry)

PostgreSQL

st_exteriorring (pl1 st_geometry)

Return type

ST_LineString

Example

An ornithologist, wanting to study the bird population on several South Seas islands, knows that the feeding zone of the bird species she is interested in is restricted to the shoreline. As part of her calculation of the island's carrying capacity, the ornithologist requires the islands' perimeters. Some of the islands are so large they have several ponds on them. However, the shoreline of the ponds is inhabited exclusively by another more aggressive bird species. Therefore, the ornithologist requires the perimeter of only the exterior ring of the islands.

The ID and name columns of the islands table identify each island, while the land polygon column stores the island's geometry.

Oracle

CREATE TABLE islands (id integer,
name varchar(32),
land sde.st_geometry);

INSERT INTO islands VALUES (
1,
'Bear',
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)
);

INSERT INTO islands VALUES (
2,
'Johnson',
sde.st_polygon ('polygon ((10 10, 50 10, 10 30, 10 10))', 0)
);

PostgreSQL

CREATE TABLE islands (id integer,
name varchar(32),
land st_geometry);

INSERT INTO islands VALUES (
1,
'Bear',
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)
);

INSERT INTO islands VALUES (
2,
'Johnson',
st_polygon ('polygon ((10 10, 50 10, 10 30, 10 10))', 0)
);

The ST_ExteriorRing function extracts the exterior ring from each island polygon as a linestring. The length of the linestring is calculated by the ST_Length function. The linestring lengths are summarized by the SUM function.

Oracle

SELECT SUM (sde.st_length (sde.st_exteriorring (land)))
FROM islands;

SUM(ST_LENGTH(ST_EXTERIORRING(LAND)))

                            264.72136

PostgreSQL

SELECT SUM (st_length (st_exteriorring (land)))
FROM islands;

sum

264.721359549996

The exterior rings of the islands represent the ecological interface each island shares with the sea.

Some of the islands have ponds, which are represented by the interior rings of the polygons.

See Also

  • An overview of SQL functions used with ST_Geometry types