PostGIS

ST_NRings

Prev

8.4. Geometry Accessors

Next

Name

ST_NRings — Returns the number of rings in a polygonal geometry.

Synopsis

integer +`*`+ST_NRings*(`geometry `geomA`)`;

Description

If the geometry is a polygon or multi-polygon returns the number of rings. Unlike NumInteriorRings, it counts the outer rings as well.

check This function supports 3d and will not drop the z-index.

check This method supports Circular Strings and Curves

Examples

SELECT ST_NRings(geom) As Nrings, ST_NumInteriorRings(geom) As ninterrings
                    FROM (SELECT ST_GeomFromText('POLYGON((1 2, 3 4, 5 6, 1 2))') As geom) As foo;
     nrings | ninterrings
--------+-------------
      1 |           0
(1 row)

See Also

Prev

Up

Next

ST_NPoints

Home

ST_NumGeometries