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.
Function | Syntax |
---|---|
Python | num |
SQL | ST |
Scala | num |
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
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
+------------------+
|num_interior_rings|
+------------------+
| 0|
| 1|
+------------------+
Version table
Release | Notes |
---|---|
1.0.0-beta | Python, SQL, and Scala functions introduced |