st_touches
Preview
This feature is in Public Preview.
Returns True if the two geometries touch each other. Geometry collections are not supported.
For the corresponding Databricks SQL function, see st_touches function.
Syntax
Python
from pyspark.databricks.sql import functions as dbf
dbf.st_touches(col1=<col1>, col2=<col2>)
Parameters
Parameter | Type | Description |
|---|---|---|
|
| The first Geometry value. |
|
| The second Geometry value. |
Notes
The two geometries are expected to have the same SRID value, otherwise an error is returned.
Examples
Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('LINESTRING(5 0,5 10)','MULTILINESTRING((0 0,10 10),(0 10,10 0))',)], ['wkt1', 'wkt2'])
df.select(dbf.st_touches(dbf.st_geomfromtext('wkt1'), dbf.st_geomfromtext('wkt2')).alias('result')).collect()
Output
[Row(result=False)]
Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('LINESTRING(5 5,5 0,10 0)','MULTILINESTRING((0 0,10 10),(0 10,10 0))',)], ['wkt1', 'wkt2'])
df.select(dbf.st_touches(dbf.st_geomfromtext('wkt1'), dbf.st_geomfromtext('wkt2')).alias('result')).collect()
Output
[Row(result=True)]