Skip to main content

st_union_agg

Preview

This feature is in Public Preview.

Returns the point-wise union of all the geometries in the column, or None if the column has zero rows, or contains only None values.

For the corresponding Databricks SQL function, see st_union_agg function.

Syntax

Python
from pyspark.databricks.sql import functions as dbf

dbf.st_union_agg(col=<col>)

Parameters

Parameter

Type

Description

col

pyspark.sql.Column or str

A Geometry value.

Examples

Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('MULTIPOINT(EMPTY,4 3,5 6,-1 8)',), ('POLYGON((0 0,10 0,0 10,0 0))',)], ['wkt'])
df.select(dbf.st_asewkt(dbf.st_union_agg(dbf.st_geomfromtext('wkt', 4326))).alias('result')).collect()
Output
[Row(result='SRID=4326;GEOMETRYCOLLECTION(MULTIPOINT((-1 8),(5 6)),POLYGON((0 0,10 0,0 10,0 0)))')]