共用方式為


geo_geohash_neighbors()

適用於:✅Microsoft網狀架構Azure 數據✅總管 Azure 監視器✅Microsoft Sentinel

計算 Geohash 鄰居。

深入瞭解 geohash

語法

geo_geohash_neighbors(geohash)

深入瞭解 語法慣例

參數

姓名 類型​​ 必要 描述
geohash string ✔️ 以geo_point_to_geohash()計算的地理hash 值。 地理hash 字串必須介於1到18個字元之間。

傳回

Geohash 鄰居的陣列。 如果 Geohash 無效,查詢會產生 Null 結果。

範例

下列範例會計算 Geohash 鄰居。

print neighbors = geo_geohash_neighbors('sunny')

輸出

鄰居
[“sunnt”、“sunpj”、“sunnx”、“sunpn”、“sunnv”、“sunpp”、“sunnz”、“sunnw”]

下列範例會計算輸入 Geohash 及其鄰近項目的陣列。

let geohash = 'sunny';
print cells = array_concat(pack_array(geohash), geo_geohash_neighbors(geohash))

輸出

細胞
[“sunnt”、“sunpj”、“sunnx”、“sunpn”、“sunnv”、“sunpp”、“sunnz”、“sunnw”]

下列範例會計算 GeojSON 幾何集合的 Geohash 多邊形。

let geohash = 'sunny';
print cells = array_concat(pack_array(geohash), geo_geohash_neighbors(geohash))
| mv-expand cells to typeof(string)
| project polygons = geo_geohash_to_polygon(cells)
| summarize arr = make_list(polygons)
| project geojson = bag_pack("type", "Feature","geometry", bag_pack("type", "GeometryCollection", "geometries", arr), "properties", bag_pack("name", "polygons"))

輸出

geojson
{“type”: “Feature”,“geometry”: {“type”: “GeometryCollection”,“geometries”: [
{“type”:“Polygon”,“coordinates”:[[42.451171875,23.6865234375],[42.4951171875,23.6865234375],[42.4951171875,23.73046875],[42.451171875,23.73046875],[42.451171875,23.6865234375]]},
{“type”:“Polygon”,“coordinates”:[[[[42.4072265625,23.642578125],[42.451171875,23.642578125],[42.4511718 75,23.6865234375],[42.4072265625,23.6865234375],[42.4072265625,23.642578125]]},
{“type”:“Polygon”,“coordinates”:[[[[[42.4072265625,23.73046875],[42.451171875,23.73046875],[42.4511718 75,23.7744140625],[42.4072265625,23.7744140625],[42.4072265625,23.73046875]]},
{“type”:“Polygon”,“coordinates”:[[42.4951171875,23.642578125],[42.5390625,23.642578125],[42.5390625],23.6865234375],[42.4951171875,23.68652375],[42.4951171875,23.642578125]]},
{“type”:“Polygon”,“coordinates”:[[[42.451171875,23.73046875],[42.4951171875,23.73046875],[42.4951171875,23.7744140625],[42.451171875,23.7744140625],[42.451171875,23.73046875]]},
{“type”:“Polygon”,“coordinates”:[[[42.4072265625,23.6865234375],[42.451171875,23.6865234375],[42.451171875,23.73046875],[42.4072265625,23.73046875],[42.4072265625,23.6865234375]]},
{“type”:“Polygon”,“coordinates”:[[42.4951171875,23.73046875],[42.5390625,23.73046875],[42.5390625 ,23.7744140625],[42.4951171875,23.7744140625],[42.4951171875,23.73046875]]},
{“type”:“Polygon”,“coordinates”:[[[[[42.4951171875,23.6865234375],[42.5390625,23.6865234375],[42.5390625,23.73046875],[42.4951171875,23.73046875],[42.4951171875,23.6865234375]]},
{“type”:“Polygon”,“coordinates”:[[42.451171875,23.642578125],[42.4951171875,23.642578125],[42.4951171875,23.6865234375],[42.451171875,23.6865234375],[42.451171875,23.642578125]]}},
“properties”: {“name”: “polygons”}}

下列範例會計算代表 Geohash 及其鄰近的多邊形等位。

let h3cell = 'sunny';
print cells = array_concat(pack_array(h3cell), geo_geohash_neighbors(h3cell))
| mv-expand cells to typeof(string)
| project polygons = geo_geohash_to_polygon(cells)
| summarize arr = make_list(polygons)
| project polygon = geo_union_polygons_array(arr)

輸出

多邊形
{"type":"Polygon","coordinates":[[[42.4072265625,23.642578125],[42.451171875,23.642578125],[42.4951171875,23.642578125],[42.5390625,23.642578125],[42.5390625,23.686523437500004],[42.5390625,23.730468750000004],[42.5390625,23.7744140625],[42.4951171875,23.7744140625],[42.451171875,23.7744140625],[42.407226562499993,23.7744140625],[42.4072265625,23.73046875],[42.4072265625,23.6865234375],[42.4072265625,23.642578125]]]}

下列範例會傳回 true,因為 Geohash 令牌輸入無效。

print invalid = isnull(geo_geohash_neighbors('a'))

輸出

無效
1