Skip to content

Instantly share code, notes, and snippets.

@cosh
Last active October 15, 2022 06:18
Show Gist options
  • Save cosh/30626d87fc7e585365523fdb460d6195 to your computer and use it in GitHub Desktop.
Save cosh/30626d87fc7e585365523fdb460d6195 to your computer and use it in GitHub Desktop.
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 pack(
"type", "Feature",
"geometry", pack("type", "GeometryCollection", "geometries", h3_hash_polygon_lst),
"properties", pack("name", "H3 polygons collection"))
Display the source blob
Display the rendered blob
Raw
{
"type": "Feature",
"geometry": {
"type": "GeometryCollection",
"geometries": [
{
"type": "Polygon",
"coordinates": [
[
[
-73.9609635556213,
40.829061732419916
],
[
-74.00569135138367,
40.82168093780192
],
[
-74.01944838354662,
40.79043914023696
],
[
-73.98852232840895,
40.766594382212254
],
[
-73.94384490497663,
40.77396440203852
],
[
-73.93004320296495,
40.805189944379514
],
[
-73.9609635556213,
40.829061732419916
]
]
]
},
{
"type": "Polygon",
"coordinates": [
[
[
-73.90238507875488,
40.867671551513595
],
[
-73.94715685019348,
40.860310688399885
],
[
-73.9609635556213,
40.829061732419916
],
[
-73.93004320296495,
40.805189944379514
],
[
-73.88532193106172,
40.812540084842404
],
[
-73.87147055107177,
40.843772725733125
],
[
-73.90238507875488,
40.867671551513595
]
]
]
},
{
"type": "Polygon",
"coordinates": [
[
[
-73.94384490497663,
40.77396440203852
],
[
-73.98852232840895,
40.766594382212254
],
[
-74.0022744646159,
40.73537602621502
],
[
-73.97139376102862,
40.71154393543933
],
[
-73.92676660481357,
40.71890320501306
],
[
-73.91296992347031,
40.75010530534533
],
[
-73.94384490497663,
40.77396440203852
]
]
]
}
]
},
"properties": {
"name": "H3 polygons collection"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment