ST_Polygon

ST_Polygon takes an array column and returns a polygon column. The input column must contain an array of point geometries.

FunctionSyntax
Pythonpolygon(points)
SQLST_Polygon(points)
Scalapolygon(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

PythonPythonSQLScala
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
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
Use dark colors for code blocksCopy
1
2
3
4
5
+-----------------------------------------------+
|polygon                                        |
+-----------------------------------------------+
|{"rings":[[[0,0],[10,0],[10,10],[0,10],[0,0]]]}|
+-----------------------------------------------+

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.