All Products
Search
Document Center

ApsaraDB RDS:ST_GeoHashID

Last Updated:Mar 28, 2026

Converts a GeoHash string into a bigint value to improve storage and query efficiency.

Syntax

bigint ST_GeoHashID(cstring geoHash);

Parameters

ParameterDescription
geoHashThe GeoHash string to convert. Supports strings up to 11 characters.

Description

ST_GeoHashID encodes a GeoHash string as a bigint integer. Storing geospatial locations as integers reduces storage overhead and speeds up indexing and spatial computations compared to string-based GeoHash values.

Examples

Convert a point geometry to a GeoHash string and then to a bigint ID:

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

Output:

 2220678768189336756