ST_Split takes a linestring or polygon column and a linestring column and returns an array column. This function splits the geometry with the splitter linestring and returns the resulting parts as an array of geometries. If the input geometry is a linestring, the output will be an array of linestrings. If the input geometry type is a polygon, the output will be an array of polygons. If a linestring is split by an equal linestring, an empty linestring along with the input linestring and the splitter linestring are returned.
Function | Syntax |
---|---|
Python | split(geometry, splitter) |
SQL | ST |
Scala | split(geometry, splitter) |
For more details, go to the GeoAnalytics for Microsoft Fabric API reference for split.
Examples
from geoanalytics_fabric.sql import functions as ST, Linestring, Polygon
df = spark.createDataFrame([(Linestring([[[0, -30],[0, 30]]]), Polygon([[[-20, -20],[20, -20],[20, 20],[-20, 20]]]))],
["linestring", "polygon"])
df.select(ST.split("polygon", "linestring").alias("split")).show(truncate=False)
+------------------------------------------------------------------------------------------------------------------+
|split |
+------------------------------------------------------------------------------------------------------------------+
|[{"rings":[[[-20,-20],[-20,20],[0,20],[0,-20],[-20,-20]]]}, {"rings":[[[0,-20],[0,20],[20,20],[20,-20],[0,-20]]]}]|
+------------------------------------------------------------------------------------------------------------------+
Version table
Release | Notes |
---|---|
1.0.0-beta | Python, SQL, and Scala functions introduced |