ST_InteriorRingN takes a polygon column and a numeric value (n) and returns a linestring column.
The output is the nth interior ring of the input polygon as a linestring. If there is more than one interior
ring, the order of the interior rings is defined by the order in the input polygon. When n=0
, the first interior ring
is returned. If the index exceeds the number of interior rings in the polygon, null
is returned. If the input is a
multipolygon null
is returned.
Function | Syntax |
---|---|
Python | interior |
SQL | ST |
Scala | interior |
For more details, go to the GeoAnalytics for Microsoft Fabric API reference for interior_ring_n.
This function implements the OpenGIS Simple Features Implementation Specification for SQL 1.2.1.
Examples
from geoanalytics_fabric.sql import functions as ST, Polygon
data =[("POLYGON ((10 10, 40 10, 40 40, 10 40, 10 10),"+\
"(15 15, 20 15, 20 30, 15 30, 15 15), (30 15, 35 15, 35 30, 30 30, 30 15))",),
("POLYGON ((20 0, 30 20, 40 0, 20 0))",)]
df = spark.createDataFrame(data, ["wkt"]) \
.withColumn("polygon", ST.poly_from_text("wkt"))
df.select(ST.interior_ring_n("polygon", 1).alias("interior_ring_n")).show(truncate=False)
+-----------------------------------------------------+
|interior_ring_n |
+-----------------------------------------------------+
|{"paths":[[[30,15],[30,30],[35,30],[35,15],[30,15]]]}|
|NULL |
+-----------------------------------------------------+
Version table
Release | Notes |
---|---|
1.0.0-beta | Python, SQL, and Scala functions introduced |