This topic describes the ST_PointFromGeoHash function. This function constructs a point object by using a Geohash string.
Syntax
point ST_PointFromGeoHash(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 a point object. If you do not specify a precision, this function returns a point object by using the Geohash string in the full precision. |
Description
The point object that is constructed by this function is the center point of the region that is represented by the Geohash string.
Examples
- Construct a point object by using the default parameter settings.
SELECT ST_AsText(ST_PointFromGeoHash('wx47x9u8gumnhzp791zb')); st_astext ----------------------------- POINT(116 39.9999999999999) (1 row)
- Construct a point object by using a custom precision.
SELECT ST_AsText(ST_PointFromGeoHash('wx47x9u8gumnhzp791zb',2)); st_astext ------------------------ POINT(118.125 42.1875) (1 row)