geo_geohash_neighbors ()
計算 Geohash 芳鄰。
深入閱讀 geohash
。
語法
geo_geohash_neighbors(
geohash)
深入瞭解 語法慣例。
參數
名稱 | 類型 | 必要 | Description |
---|---|---|---|
geohash | string |
✔️ | geo_point_to_geohash () 計算的地理哈希值。 Geohash 字串必須介於 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.451171875,23.6865234375],[42.4072265625,23.6865234375],[42.4072265625,23.642578125]]]}, {“type”:“Polygon”,“coordinates”:[[[42.4072265625,23.73046875],[42.451171875,23.73046875],[42.451171875,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.6865234375],[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]]]} |
下列範例會因為無效的 Geohash 令牌輸入而傳回 true。
print invalid = isnull(geo_geohash_neighbors('a'))
輸出
無效 |
---|
1 |
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應