ST_PointFromGeoHash

更新时间:
复制 MD 格式

Constructs a point from a Geohash string. The returned point is the center point of the geographic area represented by the Geohash string.

Syntax

point  ST_PointFromGeoHash(text  geohash , integer  precision);

Parameters

ParameterDescription
geohashThe Geohash string.
precisionThe precision at which to construct the point. If not specified, the function returns a point at the full precision of the input Geohash string.

Description

The returned point is the center point of the geographic area represented by the Geohash string.

Examples

Construct a point using the default precision

SELECT ST_AsText(ST_PointFromGeoHash('wx47x9u8gumnhzp791zb'));

Result:

          st_astext
-----------------------------
 POINT(116.00000000000007 39.999999999999936)
(1 row)

Construct a point using a custom precision

SELECT ST_AsText(ST_PointFromGeoHash('wx47x9u8gumnhzp791zb',2));

Result:

       st_astext
------------------------
 POINT(118.125 42.1875)
(1 row)