หมายเหตุ
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลอง ลงชื่อเข้าใช้หรือเปลี่ยนไดเรกทอรีได้
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลองเปลี่ยนไดเรกทอรีได้
Important
This feature is in Public Preview.
Returns the point-set union of the two input geometries as a 2D geometry.
For the corresponding Databricks SQL function, see st_union function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.st_union(col1=<col1>, col2=<col2>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col1 |
pyspark.sql.Column or str |
The first Geometry value. |
col2 |
pyspark.sql.Column or str |
The second Geometry value. |
Notes
The two geometries are expected to have the same SRID value, otherwise an error is returned.
Examples
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))',)], ['wkt1', 'wkt2'])
df.select(dbf.st_asewkt(dbf.st_union(dbf.st_geomfromtext('wkt1', 4326), dbf.st_geomfromtext('wkt2', 4326))).alias('result')).collect()
[Row(result='SRID=4326;GEOMETRYCOLLECTION(POINT(-1 8),POINT(5 6),POLYGON((0 0,0 10,10 0,0 0)))')]