跳到主要内容

ST_GEOHASH

Introduced or updated: v1.2.436

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.

Syntax

ST_GEOHASH(<geometry> [, <precision>])

Arguments

ArgumentsDescription
geometryThe argument must be an expression of type GEOMETRY.
[precision]Optional. specifies the precision of the returned geohash, default is 12.

Return Type

String.

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 │
└──────────────────┘
开始使用 Databend Cloud
低成本
快速分析
多种数据源
弹性扩展
注册