geo_h3cell_children()

計算 H3 資料格的子系。

深入了解 H3 資料格

語法

geo_h3cell_children(h3cell,resolution)

深入瞭解 語法慣例

參數

名稱 類型 必要 Description
h3cell string ✔️ geo_point_to_h3cell () 計算的 H3 單元格標記值。
resolution int 定義要求的子數據格解析度。 支援的值位於範圍 [1, 15] 中。 如果未指定,則會計算立即子令牌。

傳回

H3 資料格子系語彙基元的陣列。 如果 H3 資料格無效,或子解析低於指定的資料格,則查詢將會產生 Null 結果。

注意

資料格解析與其子系之間的差異不能超過 5。 5 個層級的差異將會導致最多 16807 個子系語彙基元。

範例

print children = geo_h3cell_children('862a1072fffffff')

輸出

兒童
[ "872a10728ffffff", "872a10729ffffff", "872a1072affffff", "872a1072bffffff", "872a1072cffffff", "872a1072dffffff", "872a1072effffff" ]

下列範例會計算所指定資料格下方的子系 3 層級數目。

let h3_cell = '862a1072fffffff'; 
print children_count = array_length(geo_h3cell_children(h3_cell, geo_h3cell_level(h3_cell) + 3))

輸出

children_count
343

下列範例會組合 H3 資料格子系多邊形的 GeoJSON 幾何集合。

print children = geo_h3cell_children('862a1072fffffff')
| mv-expand children to typeof(string)
| project child = geo_h3cell_to_polygon(children)
| summarize h3_hash_polygon_lst = make_list(child)
| project geojson = bag_pack(
    "type", "Feature",
    "geometry", bag_pack("type", "GeometryCollection", "geometries", h3_hash_polygon_lst),
    "properties", bag_pack("name", "H3 polygons collection"))

輸出

geojson
{ "type": "Feature", "geometry": { "type": "GeometryCollection", "geometries": [ ... ... ... ] }, "properties": { "name": "H3 polygons collection" }}

由於儲存格無效,因此下列範例會傳回 true。

print is_null = isnull(geo_h3cell_children('abc'))

輸出

is_null
1

下列範例傳回 True,因為資料格與其子系之間的層級差異大於 5。

print is_null = isnull(geo_h3cell_children(geo_point_to_h3cell(1, 1, 9), 15))

輸出

is_null
1