All Products
Search
Document Center

PolarDB:ST_GeoHashID

Last Updated:Mar 28, 2026

Converts a Geohash string to a bigint integer, making it efficient to store and compute geospatial location data.

Syntax

bigint ST_GeoHashID(cstring geoHash);

Parameters

ParameterDescription
geoHashThe Geohash string to convert. Supports strings up to 16 characters.

Description

ST_GeoHashID encodes a Geohash string as a bigint integer. Storing locations as integers rather than strings reduces storage overhead and speeds up indexed lookups and spatial computations.

The function accepts Geohash strings up to 16 characters in length.

Examples

Convert a Geohash generated from a WKT point to a bigint:

SELECT ST_GeoHashID(
    ST_GeoHash(ST_GeomFromWKT('POINT(-115.172816 36.114646)'), 11)::cstring
);

Result:

---------------------
 2220678768189336756