geo_h3cell_to_polygon()
计算表示 H3 单元格矩形区域的多边形。
详细了解 H3 单元格。
语法
geo_h3cell_to_polygon(
h3cell)
详细了解语法约定。
参数
客户 | 类型 | 必需 | 说明 |
---|---|---|---|
h3cell | string |
✔️ | 由 geo_point_to_h3cell() 算出的 H3 单元格令牌值。 |
返回
采用 GeoJSON 格式的动态数据类型的多边形。 如果 H3 单元格无效,则查询会生成 null 结果。
注意
H3 单元格多边形的边缘是直线,不是测地线。 如果 H3 单元格多边形是某个其他计算的一部分,请考虑使用 geo_polygon_densify() 对其进行致密化。
示例
print geo_h3cell_to_polygon("862a1072fffffff")
输出
print_0 |
---|
{ "type": "Polygon", "coordinates": [[[-74.0022744646159, 40.735376026215022], [-74.046908029686236, 40.727986222489115], [-74.060610712223664, 40.696775140349033],[ -74.029724408156682, 40.672970047595463], [-73.985140983708192, 40.680349049267583],[ -73.971393761028622, 40.71154393543933], [-74.0022744646159, 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"))
输出
Column1 |
---|
{ "type": "Feature", "geometry": {"type": "GeometryCollection", "geometries": [{"type": "Polygon","coordinates": [[[-73.9609635556213, 40.829061732419916], [-74.005691351383675, 40.821680937801922], [-74.019448383546617, 40.790439140236963], [-73.988522328408948, 40.766594382212254], [-73.943844904976629, 40.773964402038523], [-73.930043202964953, 40.805189944379514], [-73.9609635556213, 40.829061732419916]]]}, {"type": "Polygon", "coordinates": [[[-73.902385078754875, 40.867671551513595], [-73.94715685019348, 40.860310688399885], [-73.9609635556213, 40.829061732419916], [-73.930043202964953, 40.805189944379514], [-73.885321931061725, 40.812540084842404 ], [-73.871470551071766, 40.843772725733125], [ -73.902385078754875, 40.867671551513595]]]}, {"type": "Polygon","coordinates": [[[-73.943844904976629, 40.773964402038523], [-73.988522328408948, 40.766594382212254], [-74.0022744646159, 40.735376026215022], [-73.971393761028622, 40.71154393543933], [-73.926766604813565, 40.718903205013063], [ -73.912969923470314, 40.750105305345329 ], [-73.943844904976629, 40.773964402038523]]]}] }, "properties": {"name": "H3 polygons collection"} } |
以下示例由于 H3 单元格令牌输入无效而返回 null 结果。
print geo_h3cell_to_polygon("@")
输出
print_0 |
---|