共用方式為


geo_h3cell_to_polygon()

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

計算代表 H3 單元格矩形區域的多邊形。

深入瞭解 H3 單元格

語法

geo_h3cell_to_polygon(h3cell)

深入瞭解 語法慣例

參數

姓名 類型​​ 必要 描述
h3cell string ✔️ H3 儲存格標記值,因為它是由 geo_point_to_h3cell() 計算。

傳回

GeoJSON 格式和動態數據類型的多邊形。 如果 H3 儲存格無效,查詢將會產生 Null 結果。

注意

H3 單元格多邊形邊緣是直線,不是地理區域。 如果 H3 單元格多邊形是其他計算的一部分,請考慮使用 geo_polygon_densify() 將其反正規化。

範例

print geo_h3cell_to_polygon("862a1072fffffff")

輸出

print_0
{
“type”: “Polygon”,
“coordinates”: [[-74.002274646159, 40.735376026215022], [-74.046908029686236, 40.727986222489115], [-74.06061071223664, 40.696775140349033],[ -74.029724408156682, 40.672970047595463], [-73.985140983708192, 40.680349049267583],[ -73.971393761028622,40.71154393543933], [-74.002274646159, 40.735376026215022]]
}

下列範例會組合 H3 單元格多邊形的 GeoJSON 幾何集合。

// H3 cell GeoJSON collection
datatable(lng:real, lat:real)
[
    -73.956683, 40.807907,
    -73.916869, 40.818314,
    -73.989148, 40.743273,
]
| project h3_hash = geo_point_to_h3cell(lng, lat, 6)
| project h3_hash_polygon = geo_h3cell_to_polygon(h3_hash)
| summarize h3_hash_polygon_lst = make_list(h3_hash_polygon)
| project bag_pack(
    "type", "Feature",
    "geometry", bag_pack("type", "GeometryCollection", "geometries", h3_hash_polygon_lst),
    "properties", bag_pack("name", "H3 polygons collection"))

輸出

資料行1
{
“type”: “Feature”,
“geometry”: {“type”: “GeometryCollection”, “geometries”: [{“type”: “Polygon”,“coordinates”: [[[[-73.960963556213, 40.829061732419916], [-74.005691351383675, 40.821680937801922], [-74.019448383546617, 40.790439140236963], [-73.988522328408948, 40.76659438221254], [-73.94384490497629, 40.773964402038523], [-73.930043202964953、40.805189944379514]、[-73.960963556213、40.829061732419916]]}、
{“type”: “Polygon”, “coordinates”: [[[-73.902385078754875, 40.867671551595], [-73.94715685019348, 40.860310688399885], [-73.960963556213, 40.829061732419916], [-73.930043202964953, 40.805189944379514], [-73.885321931061725, 40.812540084842404 ], [-73.871470551071766、40.843772725733125]、[ -73.9023850787548754875、40.86767155151513595]]},
{“type”: “Polygon”,“coordinates”: [[[[[-73.9438490497629, 40.773964402038523], [-73.988522328408948, 40.76659438221254], [-74.0022744646159, 40.735376026215022], [-73.971393761028622, 40.71154393543933], [-73.92676604813565, 40.718903205013063], [ -73.912969923470314,40.750105305345329 ], [-73.94384490490497629, 40.773964402038523]]}]
},
“properties”: {“name”: “H3 多邊形集合”}
}

下列範例會傳回 Null 結果,因為無效的 H3 單元格令牌輸入。

print geo_h3cell_to_polygon("@")

輸出

print_0