Constructs a Box2D bounding box from a Geohash string.
Syntax
box2d ST_Box2dFromGeoHash(text geohash, integer precision)Parameters
| Parameter | Description |
|---|---|
geohash | The Geohash string to decode. |
precision | The precision based on which to construct the Box2D object. If omitted, the full precision of the Geohash string is used. |
Examples
Full precision — uses all characters of the Geohash string:
SELECT ST_Box2dFromGeoHash('wx47x9u8gumnhzp791zb'); st_box2dfromgeohash
----------------------------------
BOX(116 39.9999999999999,116 40)
(1 row)Custom precision — uses the first 5 characters, producing a larger box:
SELECT ST_Box2dFromGeoHash('wx47x9u8gumnhzp791zb', 5); st_box2dfromgeohash
-----------------------------------------------------------
BOX(115.9716796875 39.990234375,116.015625 40.0341796875)
(1 row)该文章对您有帮助吗?