全部產品
Search
文件中心

PolarDB:ST_GeomFromGeoHash

更新時間:Jul 06, 2024

返回一個與給定的GeoHash字串相對應的Geometry對象。

文法

geometry  ST_GeomFromGeoHash(text  geohash , integer  precision);

參數

參數名稱描述
geohashGeoHash字串。
precision精度。如果未指定精度,則ST_GeomFromGeoHash根據輸入的GeoHash字串的全精度返回Polygon。

樣本

  • 全精度返回:
    SELECT ST_AsText(ST_GeomFromGeoHash('wx47x9u8gumnhzp791zb'));
                               st_astext
    ---------------------------------------------------------------
     POLYGON((116 39.9999999999999,116 40,116 40,116 39.9999999999.
    .999,116 39.9999999999999))
    (1 row)
    
  • 指定精度返回:
    SELECT ST_AsText(ST_GeomFromGeoHash('wx47x9u8gumnhzp791zb',2));
                               st_astext
    ---------------------------------------------------------------
     POLYGON((112.5 39.375,112.5 45,123.75 45,123.75 39.375,112.5 .
    .39.375))
    (1 row)