ST_Segmentize takes a linestring column and a numeric column or value representing maximum segment length and returns an array column. This function creates an array of linestrings from the input linestring by breaking the input linestring into segments that are shorter than or equal to the maximum length specified. The maximum segment length is in the same units as the input geometry.
Function | Syntax |
---|---|
Python | segmentize(linestring, max |
SQL | ST |
Scala | segmentize(linestring, max |
For more details, go to the GeoAnalytics for Microsoft Fabric API reference for segmentize.
Examples
from geoanalytics_fabric.sql import functions as ST, Linestring
df = spark.createDataFrame([(Linestring([[[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]]]),)],["linestring"])
df.select(ST.segmentize("linestring", max_segment_length=2).alias("segmentize")).show(truncate=False)
Result
+------------------------------------------------------------------+
|segmentize |
+------------------------------------------------------------------+
|[{"paths":[[[0,0],[1,0],[2,0]]]}, {"paths":[[[2,0],[3,0],[4,0]]]}]|
+------------------------------------------------------------------+
Version table
Release | Notes |
---|---|
1.0.0-beta | Python, SQL, and Scala functions introduced |