This topic describes the ST_GeomFromGeoHash function. This function constructs a geometry object by using a Geohash string.


geometry  ST_GeomFromGeoHash(text  geohash , integer  precision);


Parameter Description
geohash The Geohash string that you want to specify.
precision The precision based on which you want to construct the geometry object. If you do not specify a precision, this function returns a polygon by using the Geohash string in the full precision.


  • Construct a geometry object by using the full precision.
    SELECT ST_AsText(ST_GeomFromGeoHash('wx47x9u8gumnhzp791zb'));
     POLYGON((116 39.9999999999999,116 40,116 40,116 39.9999999999.
    .999,116 39.9999999999999))
    (1 row)
  • Construct a geometry object by using a custom precision.
    SELECT ST_AsText(ST_GeomFromGeoHash('wx47x9u8gumnhzp791zb',2));
     POLYGON((112.5 39.375,112.5 45,123.75 45,123.75 39.375,112.5 .
    (1 row)