st_geohash
Preview
This feature is in Public Preview. You can confirm preview enrollment on the Previews page. See Manage Databricks previews.
Returns the geohash of the input Geometry.
For the corresponding Databricks SQL function, see st_geohash function.
Syntax
Python
from pyspark.databricks.sql import functions as dbf
dbf.st_geohash(col1=<col1>, col2=<col2>)
Parameters
Parameter | Type | Description |
|---|---|---|
|
| A Geometry value. |
|
| The optional precision (number of significant digits) of the output geohash. Must be non-negative. |
Examples
Python
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()
Output
[Row(result='9q8yyhebpbpb')]
Python
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()
Output
[Row(result='9q8yyh')]