This function describes the ST_Box2dFromGeoHash function. This function constructs a Box2D object by using a Geohash string.

Syntax

box2d  ST_Box2dFromGeoHash(text  geohash , integer  precision);

Parameters

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

Examples

  • Construct a Box2D object by using a Geohash string in the full precision.
    SELECT ST_Box2dFromGeoHash('wx47x9u8gumnhzp791zb');
           st_box2dfromgeohash
    ----------------------------------
     BOX(116 39.9999999999999,116 40)
    (1 row)
                        
  • Construct a Box2D object by using a Geohash string in a custom precision.
    SELECT ST_Box2dFromGeoHash('wx47x9u8gumnhzp791zb',5);
                        st_box2dfromgeohash
    -----------------------------------------------------------
     BOX(115.9716796875 39.990234375,116.015625 40.0341796875)
    (1 row)