ST_MultiPolygon takes an array column and returns a polygon column. The input column must contain an array of arrays of point geometries. The output polygon column represents the one or more rings created from the point arrays.
Function | Syntax |
---|---|
Python | multipolygon(*point |
SQL | ST |
Scala | multipolygon(point |
For more details, go to the GeoAnalytics for Microsoft Fabric API reference for multipolygon.
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, 5), Point(15, 15), Point(0,0)]], ),
([[Point(0, 0), Point(10, 0), Point(20, 10), Point(0,0)],
[Point(20, 30), Point(18, 28), Point(18, 28), Point(18, 28), Point(20, 30)]], )],
["point_arrays"])
df.select(ST.multipolygon("point_arrays").alias("multipolygon")).show(truncate=False)
Result
+----------------------------------------------------------------------------------+
|multipolygon |
+----------------------------------------------------------------------------------+
|{"rings":[[[0,0],[10,5],[15,15],[0,0]]]} |
|{"rings":[[[0,0],[10,0],[20,10],[0,0]],[[20,30],[18,28],[18,28],[18,28],[20,30]]]}|
+----------------------------------------------------------------------------------+
Version table
Release | Notes |
---|---|
1.0.0-beta | Python, SQL, and Scala functions introduced |