st_touches

重要

此功能目前以公共预览版提供。

如果两个几何图形相互接触,则 True 返回。 不支持几何图形集合。

有关相应的 Databricks SQL 函数,请参阅 st_touches 函数

Syntax

from pyspark.databricks.sql import functions as dbf

dbf.st_touches(col1=<col1>, col2=<col2>)

参数

参数 类型 Description
col1 pyspark.sql.Columnstr 第一个 Geometry 值。
col2 pyspark.sql.Columnstr 第二个 Geometry 值。

注释

这两个几何图形应具有相同的 SRID 值,否则将返回错误。

例子

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()
[Row(result=False)]
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()
[Row(result=True)]