geo_geohash_to_central_point()

计算表示 Geohash 矩形区中心的地理空间坐标。

阅读有关 geohash 的详细信息。

语法

geo_geohash_to_central_point(geohash)

详细了解语法约定

参数

客户 类型​​ 必需 说明
geohash string geo_point_to_geohash() 计算得出的 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]

输出

point 坐标 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 值创建指向必应地图的深层链接 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