ST_NumInteriorRings

ST_NumInteriorRings takes a polygon column and returns an integer column. The output column represents the number of interior rings in the input polygon. The function will return null when the input is a multipart polygon.

FunctionSyntax
Pythonnum_interior_rings(polygon)
SQLST_NumInteriorRings(polygon)
ScalanumInteriorRings(polygon)

For more details, go to the GeoAnalytics for Microsoft Fabric API reference for num_interior_rings.

This function implements the OpenGIS Simple Features Implementation Specification for SQL 1.2.1.

Examples

PythonPythonSQLScala
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
from geoanalytics_fabric.sql import functions as ST

data = [
    ("POLYGON ((20 30, 18 28, 22 35, 40 20))", ),
    ("POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10), (20 30, 35 35, 30 20, 20 30))",)
]

df = spark.createDataFrame(data, ["wkt"]) \
    .withColumn("polygon", ST.poly_from_text("wkt", 4326))

df.select(ST.num_interior_rings("polygon").alias("num_interior_rings")).show()
Result
Use dark colors for code blocksCopy
1
2
3
4
5
6
+------------------+
|num_interior_rings|
+------------------+
|                 0|
|                 1|
+------------------+

Version table

ReleaseNotes

1.0.0-beta

Python, SQL, and Scala functions introduced

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.