Pular para o conteúdo principal

st_interiorringn function

Applies to: check marked yes Databricks Runtime 17.3 and above

Preview

This feature is in Public Preview.

Returns the n-th interior ring of the input polygon as a linestring.

Syntax

st_interiorringn ( geoExpr, indexExpr )

Arguments

  • geoExpr: A GEOGRAPHY or GEOMETRY value.
  • indexExpr: An INTEGER value representing the 1-based position of the linestring in the polygon.

Returns

The interior ring of the polygon at the 1-based index indexExpr as a closed linestring. The output value has the same data type and SRID as geoExpr.

Notes

The function returns NULL if the input is NULL.

Error conditions

Examples

SQL
-- Example taking a 2D polygon GEOMETRY with three interior rings.
> SELECT ST_AsEWKT(ST_NumInteriorRings(ST_GeomFromText('POLYGON((0 1,10 5,4 20,0 1),(3 12,9 7,5 13,3 12),(1 4,7 5,6 8,1 4),(3 6,4 11,2 10,3 6))', 3857), 3));
SRID=3857;LINESTRING(3 6,4 11,2 10,3 6)
-- Example taking a 3DM polygon GEOGRAPHY with two interior rings.
> SELECT ST_AsEWKT(ST_NumInteriorRings(ST_GeogFromText('POLYGON M ((0 1 111,10 5 222,4 20 333,0 1 444),(3 12 111,9 7 222,5 13 333,3 12 444),(1 4 111,7 5 222,6 8 333,1 4 444))'), 2));
SRID=4326;LINESTRING M (1 4 111,7 5 222,6 8 333,1 4 444)
-- Example taking a 4D polygon GEOMETRY with one interior ring.
> SELECT ST_AsEWKT(ST_NumInteriorRings(ST_GeomFromText('POLYGON ZM ((0 1 111 -11,10 5 222 -22,4 20 333 -33,0 1 444 -44),(3 12 111 -11,9 7 222 -22,5 13 333 -33,3 12 444 -44))'), 1));
LINESTRING ZM (3 12 111 -11,9 7 222 -22,5 13 333 -33,3 12 444 -44)