geo_h3cell_to_polygon()

Applies to: ✅ Azure Data ExplorerAzure MonitorMicrosoft Sentinel

Calculates the polygon that represents the H3 Cell rectangular area.

Read more about H3 Cell.

Syntax

geo_h3cell_to_polygon(h3cell)

Learn more about syntax conventions.

Parameters

Name Type Required Description
h3cell string ✔️ An H3 Cell token value as it was calculated by geo_point_to_h3cell().

Returns

Polygon in GeoJSON Format and of a dynamic data type. If the H3 Cell is invalid, the query will produce a null result.

Note

H3 Cell polygon edges are straight lines and aren't geodesics. If an H3 Cell polygon is part of some other calculation, consider densifying it with geo_polygon_densify().

Examples

print geo_h3cell_to_polygon("862a1072fffffff")

Output

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]]]
}

The following example assembles GeoJSON geometry collection of H3 Cell polygons.

// 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"))

Output

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"}
}

The following example returns a null result because of the invalid H3 Cell token input.

print geo_h3cell_to_polygon("@")

Output

print_0