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_NRings - Amazon Redshift
This page has not been translated into your language. Request translation

ST_NRings

ST_NRings returns the number of rings in an input geometry.

Syntax

ST_NRings(geom)

Arguments

geom

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

Return type

INTEGER

If geom is null, then null is returned.

The values returned are as follows.

Returned value Geometry subtype

0

Returned if geom is a POINT, LINESTRING, MULTIPOINT, or MULTILINESTRING subtype

The number of rings.

Returned if geom is a POLYGON or MULTIPOLYGON subtype

The number of rings in all components

Returned if geom is a GEOMETRYCOLLECTION subtype

Examples

The following SQL returns the number of rings in a multipolygon.

SELECT ST_NRings(ST_GeomFromText('MULTIPOLYGON(((0 0,10 0,0 10,0 0)),((0 0,-10 0,0 -10,0 0)))'));
st_nrings ------------- 2
PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.