Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
This feature is in Public Preview.
Returns the geohash of the input Geometry.
For the corresponding Databricks SQL function, see st_geohash function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.st_geohash(col1=<col1>, col2=<col2>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col1 |
pyspark.sql.Column or str |
A Geometry value. |
col2 |
pyspark.sql.Column or int, optional |
The optional precision (number of significant digits) of the output geohash. Must be non-negative. |
Examples
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')]