返回給定Geometry對象的GeoHash表示。
文法
text ST_GeoHash(geometry geom , integer maxchars);參數
| 參數名稱 | 描述 |
| geom | 目標Geometry對象。 |
| maxchars | 精度。如果未指定maxchars,則ST_GeoHash基於輸入幾何類型的全精度返回GeoHash。 |
描述
- 對於非Point對象,計算的起點是其邊界框的中心。
- 該函數不適用於不在地理座標(經度/緯度)中的Geometry對象。
- 該函數支援Circular Strings和Curves。
樣本
- 按預設精度輸出:
SELECT ST_GeoHash(ST_GeomFromText('POINT(116 40)',4326)); st_geohash ---------------------- wx47x9u8gumnhzp791zb (1 row) - 指定輸出精度:
SELECT ST_GeoHash(ST_GeomFromText('POINT(116 40)',4326),3); st_geohash ------------ wx4 (1 row)