ST_GEOHASH (Lakehouse v1)
Return the geohash for a GEOMETRY object. A geohash is a short base32 string that identifies a geodesic rectangle containing a location in the world. The optional precision argument specifies the precision of the returned geohash. For example, passing 5 for `precision returns a shorter geohash (5 characters long) that is less precise.
SQL Syntax
Section titled “SQL Syntax”ST_GEOHASH(<geometry> [, <precision>])Arguments
Section titled “Arguments”| Arguments | Description |
|---|---|
geometry | The argument must be an expression of type GEOMETRY. |
[precision] | Optional. specifies the precision of the returned geohash, default is 12. |
Return Type
Section titled “Return Type”String.
SQL Examples
Section titled “SQL Examples”SELECT ST_GEOHASH( ST_GEOMETRYFROMWKT( 'POINT(-122.306100 37.554162)' ) ) AS pipeline_geohash;
┌──────────────────┐│ pipeline_geohash │├──────────────────┤│ 9q9j8ue2v71y │└──────────────────┘
SELECT ST_GEOHASH( ST_GEOMETRYFROMWKT( 'SRID=4326;POINT(-122.35 37.55)' ), 5 ) AS pipeline_geohash;
┌──────────────────┐│ pipeline_geohash │├──────────────────┤│ 9q8vx │└──────────────────┘