Converts a bigint value to a Geohash string. Use this function to reverse the encoding performed by ST_GeoHashID and recover the original Geohash string.
Syntax
cstring ST_GeoHashFromID(bigint value);Parameters
| Parameter | Description |
|---|---|
value | A bigint value returned by ST_GeoHashID. |
Description
ST_GeoHashFromID decodes a bigint value back into the Geohash string that was originally passed to ST_GeoHashID.
The input must be a value produced by ST_GeoHashID.
Examples
The following example shows a full round-trip: a geometry is encoded to a Geohash string, converted to a bigint by ST_GeoHashID, and then decoded back to the original Geohash string by ST_GeoHashFromID.
SELECT ST_GeoHashFromID(
ST_GeoHashID(ST_GeoHash(
ST_GeomFromWKT('POINT(-115.172816 36.114646)'), 11)::cstring));Result:
9qqj7nmxncgSee also
ST_GeoHash — converts a geometry to a Geohash string
ST_GeoHashID — converts a Geohash string to a
bigintvalue