geo_h3cell_children()

计算 H3 子单元格。

详细了解 H3 单元格

语法

geo_h3cell_children(h3cell,resolution)

详细了解语法约定

参数

客户 类型​​ 必需 说明
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