返回給定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)