Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

ST_ExteriorRing - Amazon Redshift

ST_ExteriorRing

ST_ExteriorRing returns a closed linestring that represents the exterior ring of an input polygon. The dimension of the returned geometry is the same as that of the input geometry.

Syntax

ST_ExteriorRing(geom)

Arguments

geom

A value of data type GEOMETRY or an expression that evaluates to a GEOMETRY type.

Return type

GEOMETRY of subtype LINESTRING.

The spatial reference system identifier (SRID) value of the returned geometry is the SRID value of the input geometry.

If geom is null, then null is returned.

If geom is not a polygon, then null is returned.

If geom is empty, then an empty polygon is returned.

Examples

The following SQL returns the exterior ring of a polygon as a closed linestring.

SELECT ST_AsEWKT(ST_ExteriorRing(ST_GeomFromText('POLYGON((7 9,8 7,11 6,15 8,16 6,17 7,17 10,18 12,17 14,15 15,11 15,10 13,9 12,7 9),(9 9,10 10,11 11,11 10,10 8,9 9),(12 14,15 14,13 11,12 14))')));
st_asewkt ----------- LINESTRING(7 9,8 7,11 6,15 8,16 6,17 7,17 10,18 12,17 14,15 15,11 15,10 13,9 12,7 9)
PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.