Skip to main content

st_makeline

Returns a linestring geometry whose points are the non-empty points of the geometries in the input array of geometries, which are expected to be points, linestrings, or multipoints.

For the corresponding Databricks SQL function, see st_makeline function.

Syntax

Python
from pyspark.databricks.sql import functions as dbf

dbf.st_makeline(col=<col>)

Parameters

Parameter

Type

Description

col

pyspark.sql.Column or str

An array of Geometry values.

Parameter

Type

Description

col

pyspark.sql.Column or str

An array of Geometry values.

Examples

Python
from pyspark.databricks.sql import functions as dbf
from pyspark.sql.functions import array, expr
df = spark.createDataFrame([(['POINT(1 2)','POINT(3 4)'],)], ['wkt_array'])
df.select(dbf.st_astext(dbf.st_makeline(expr("transform(wkt_array, wkt -> st_geomfromtext(wkt))"))).alias('result')).collect()
Output
[Row(result='LINESTRING(1 2,3 4)')]