geo_geohash_to_central_point()

計算代表 Geohash 矩形區域中心的地理空間座標。

深入閱讀 geohash

語法

geo_geohash_to_central_point(geohash)

深入瞭解 語法慣例

參數

名稱 類型 必要 Description
geohash string ✔️ geo_point_to_geohash () 所計算的地理哈希值。 Geohash 字串必須介於 1 到 18 個字元之間。

傳回

GeoJSON 格式動態資料類型的地理空間座標值。 如果 Geohash 無效,查詢將會產生 Null 結果。

注意

GeoJSON 格式會先指定經度,然後再指定緯度。

範例

print point = geo_geohash_to_central_point("sunny")
| extend coordinates = point.coordinates
| extend longitude = coordinates[0], latitude = coordinates[1]

輸出

座標 經度 (longitude) 緯度 (latitude)
{
"type": "Point",
"coordinates": [
42.47314453125,
23.70849609375
]
}
[
42.47314453125,
23.70849609375
]
42.47314453125 23.70849609375

由於 geohash 輸入不正確,下列範例會傳回 Null 結果。

print geohash = geo_geohash_to_central_point("a")

輸出

geohash

您可以使用 geohash 值,透過指向 geohash 中心點來建立 Bing 地圖服務的深層連結 URL:

// Use string concatenation to create Bing Map deep-link URL from a geo-point
let point_to_map_url = (_point:dynamic, _title:string) 
{
    strcat('https://www.bing.com/maps?sp=point.', _point.coordinates[1] ,'_', _point.coordinates[0], '_', url_encode(_title)) 
};
// Convert geohash to center point, and then use 'point_to_map_url' to create Bing Map deep-link
let geohash_to_map_url = (_geohash:string, _title:string)
{
    point_to_map_url(geo_geohash_to_central_point(_geohash), _title)
};
print geohash = 'sv8wzvy7'
| extend url = geohash_to_map_url(geohash, "You are here")

輸出

geohash url
sv8wzvy7 https://www.bing.com/maps?sp=point.32.15620994567871_34.80245590209961_You+are+here