ST_Split

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.

FunctionSyntax
Pythonsplit(geometry, splitter)
SQLST_Split(geometry, splitter)
Scalasplit(geometry, splitter)

For more details, go to the GeoAnalytics for Microsoft Fabric API reference for split.

Examples

PythonPythonSQLScala
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
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)
Result
Use dark colors for code blocksCopy
1
2
3
4
5
+------------------------------------------------------------------------------------------------------------------+
|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

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.