PostGIS

ST_InteriorRingN

Prev

8.4. Geometry Accessors

Next

Name

ST_InteriorRingN — Returns the Nth interior ring (hole) of a Polygon.

Synopsis

geometry +`*`+ST_InteriorRingN*(`geometry `a_polygon, integer n`)`;

Description

Returns the Nth interior ring (hole) of a POLYGON geometry as a LINESTRING. The index starts at 1. Returns NULL if the geometry is not a polygon or the index is out of range.

Note

This function does not support MULTIPOLYGONs. For MULTIPOLYGONs use in conjunction with ST_GeometryN or ST_Dump

[.inlinemediaobject]check This method implements the OGC Simple Features Implementation Specification for SQL 1.1.

check This method implements the SQL/MM specification. SQL-MM 3: 8.2.6, 8.3.5

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

Examples

SELECT ST_AsText(ST_InteriorRingN(geom, 1)) As geom
FROM (SELECT ST_BuildArea(
        ST_Collect(ST_Buffer(ST_Point(1,2), 20,3),
            ST_Buffer(ST_Point(1, 2), 10,3))) As geom
        )  as foo;