st_geohash

重要

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

返回输入 Geometry 的格哈希。

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

Syntax

from pyspark.databricks.sql import functions as dbf

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

参数

参数 类型 Description
col1 pyspark.sql.Columnstr 几何图形值。
col2 pyspark.sql.Columnint(可选) 输出 geohash 的可选精度(有效数字的个数)。 必须是非负数。

例子

from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('POINT(-122.4261475 37.77374268)',)], ['wkt'])
df.select(dbf.st_geohash(dbf.st_geomfromtext('wkt')).alias('result')).collect()
[Row(result='9q8yyhebpbpb')]
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('POINT(-122.4261475 37.77374268)',)], ['wkt'])
df.select(dbf.st_geohash(dbf.st_geomfromtext('wkt'), 6).alias('result')).collect()
[Row(result='9q8yyh')]