geo_s2cell_neighbors()
適用於:✅Microsoft網狀架構✅Azure 數據✅總管 Azure 監視器✅Microsoft Sentinel
計算 S2 儲存格芳鄰。
深入瞭解 S2 單元格階層。
語法
geo_s2cell_neighbors(
s2cell)
深入瞭解 語法慣例。
參數
姓名 | 類型 | 必要 | 描述 |
---|---|---|---|
s2cell | string |
✔️ | S2 單元格標記值,因為它是由geo_point_to_s2cell()計算。 S2 單元格標記的最大字串長度為 16 個字元。 |
傳回
S2 單元格芳鄰的陣列。 如果 S2 單元格無效,查詢會產生 Null 結果。
注意
S2 單元格邊緣為球形地理區域。
範例
下列範例會計算 S2 單元格芳鄰。
print neighbors = geo_s2cell_neighbors('89c259')
輸出
鄰居 |
---|
[“89c25d”、“89c2f9”、“89c251”、“89c257”、“89c25f”、“89c25b”、“89c2f7”、“89c2f5”] |
下列範例會計算具有其芳鄰的輸入 S2 單元格陣列。
let s2cell = '89c259';
print cells = array_concat(pack_array(s2cell), geo_s2cell_neighbors(s2cell))
輸出
細胞 |
---|
[“89c259”、“89c25d”、“89c2f9”、“89c251”、“89c257”、“89c25f”、“89c25b”、“89c2f7”、“89c2f5”] |
下列範例會計算 S2 單元格多邊形 GeoJSON 幾何集合。
let s2cell = '89c259';
print cells = array_concat(pack_array(s2cell), geo_s2cell_neighbors(s2cell))
| mv-expand cells to typeof(string)
| project polygons = geo_s2cell_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”: [[[ -74.03001249838478, 40.801268439439],[ -74.030012249838478, 40.7222262918358],[ -73.935982114337421, 40.708880489804564],[ -73.935982114337421, 40.787917134506841],[ -74.030012249838478, 40.8012684339439]]}, {“type”: “Polygon”,“coordinates”: [[[ -73.93598211437421, 40.7088804898048964],[ -73.935982114337421, 40.62973643321796],[ -73.84190634076248, 40.616308079144915],[ -73.84190634076248, 40.695446474556284],[ -73.935982114337421, 40.70888048980489804564]]}, {“type”: “Polygon”,“coordinates”: [[[ -74.1239959854733, 40.893471289549765],[ -74.1239959854733, 40.814531536204242],[ -74.030012249838478, 40.8012684339439],[ -74.030012249838478, 40.880202851376716],[ -74.1239959854733, 40.893471289549765]]}, {“type”: “Polygon”,“coordinates”: [[[ -74.1239959854733, 40.73548394999387],[ -74.1239959854733, 40.656328734184143],[ -74.030012249838478, 40.643076628676461],[ -74.030012249838478, 40.7222262918358],[ -74.1239959854733, 40.735483949993387]]}, {“type”: “Polygon”,“coordinates”: [[[ -74.1239959854733, 40.814531536204242],[ -74.1239959854733, 40.735483949993387],[ -74.030012249838478, 40.722262918358],[ -74.030012249838478, 40.8012684339439],[ -74.1239959854733, 40.814531536204242]]}, {“type”: “Polygon”,“coordinates”: [[[ -73.935982114337421, 40.787917134506841],[ -73.935982114337421, 40.708880489804564],[ -73.84190634076248, 40.695446474556284],[ -73.84190634076248, 40.774477568182071],[ -73.935982114337421, 40.787917134506841]]}, {“type”: “Polygon”,“coordinates”: [[[ -74.03001249838478, 40.722262918358],[ -74.030012249838478, 40.643076628676461],[ -73.935982114337421, 40.629736433321796],[ -73.93598211437421, 40.708880489804564],[ -74.030012249838478, 40.722262918358]]}, {“type”: “Polygon”,“coordinates”: [[[ -74.03001249838478, 40.880202851376716],[ -74.030012249838478, 40.8012684339439],[ -73.935982114337421, 40.787917134506841],[ -73.93598211437421, 40.866846163445771],[ -74.030012249838478, 40.880202851376716]]}, {“type”: “Polygon”,“coordinates”: [[[ -73.935982114337421, 40.866846163445771],[ -73.935982114337421, 40.787917134506841],[ -73.84190634076248, 40.774477568182071],[ -73.84190634076248, 40.853401155678846],[ -73.935982114337421, 40.866846163445771]]]}, “properties”: {“name”: “polygons”}} |
下列範例會計算代表 S2 單元格及其鄰近的多邊形等位。
let s2cell = '89c259';
print cells = array_concat(pack_array(s2cell), geo_s2cell_neighbors(s2cell))
| mv-expand cells to typeof(string)
| project polygons = geo_s2cell_to_polygon(cells)
| summarize arr = make_list(polygons)
| project polygon = geo_union_polygons_array(arr)
輸出
多邊形 |
---|
{"type": "Polygon","coordinates": [[[-73.841906340776248,40.695446474556284],[-73.841906340776248,40.774477568182071],[-73.841906340776248,40.853401155678846],[-73.935982114337421,40.866846163445771],[-74.030012249838478,40.880202851376716],[-74.1239959854733,40.893471289549758],[-74.1239959854733,40.814531536204242],[-74.1239959854733,40.735483949993387],[-74.1239959854733,40.656328734184143],[-74.030012249838478,40.643076628676461],[-73.935982114337421,40.629736433321796],[-73.841906340776248,40.616308079144915],[-73.841906340776248,40.695446474556284]]]} |
下列範例會傳回 true,因為 S2 單元格標記輸入無效。
print invalid = isnull(geo_s2cell_neighbors('a'))
輸出
無效 |
---|
1 |