ST_Polygon takes an array column and returns a polygon column. The input column must contain an array of point geometries.
Function | Syntax |
---|---|
Python | polygon(points) |
SQL | ST |
Scala | polygon(points) |
For more details, go to the GeoAnalytics for Microsoft Fabric API reference for polygon.
This function implements the OpenGIS Simple Features Implementation Specification for SQL 1.2.1.
Examples
from geoanalytics_fabric.sql import functions as ST, Point
df = spark.createDataFrame([([Point(0, 0), Point(10, 0), Point(10, 10), Point(0, 10)], )], ["point_array"])
df.select(ST.polygon("point_array").alias("polygon")).show(truncate=False)
Result
+-----------------------------------------------+
|polygon |
+-----------------------------------------------+
|{"rings":[[[0,0],[10,0],[10,10],[0,10],[0,0]]]}|
+-----------------------------------------------+
Version table
Release | Notes |
---|---|
1.0.0-beta | Python, SQL, and Scala functions introduced |