Skip to content

Instantly share code, notes, and snippets.

@cosh
Created June 14, 2021 20:51
Show Gist options
  • Save cosh/e9b5d65b813b4fe4fb7b8d4bd6386287 to your computer and use it in GitHub Desktop.
Save cosh/e9b5d65b813b4fe4fb7b8d4bd6386287 to your computer and use it in GitHub Desktop.
// Geohash GeoJSON collection
datatable(lng:real, lat:real)
[
-73.975212, 40.789608,
-73.916869, 40.818314,
-73.989148, 40.743273,
]
| project geohash = geo_point_to_geohash(lng, lat, 5)
| project geohash_polygon = geo_geohash_to_polygon(geohash)
| summarize geohash_polygon_lst = make_list(geohash_polygon)
| project pack(
"type", "Feature",
"geometry", pack("type", "GeometryCollection", "geometries", geohash_polygon_lst),
"properties", pack("name", "Geohash polygons collection"))
Display the source blob
Display the rendered blob
Raw
{
"type": "Feature",
"geometry": {
"type": "GeometryCollection",
"geometries": [
{
"type": "Polygon",
"coordinates": [
[
[
-74.00390625,
40.78125
],
[
-73.9599609375,
40.78125
],
[
-73.9599609375,
40.8251953125
],
[
-74.00390625,
40.8251953125
],
[
-74.00390625,
40.78125
]
]
]
},
{
"type": "Polygon",
"coordinates": [
[
[
-73.9599609375,
40.78125
],
[
-73.916015625,
40.78125
],
[
-73.916015625,
40.8251953125
],
[
-73.9599609375,
40.8251953125
],
[
-73.9599609375,
40.78125
]
]
]
},
{
"type": "Polygon",
"coordinates": [
[
[
-74.00390625,
40.7373046875
],
[
-73.9599609375,
40.7373046875
],
[
-73.9599609375,
40.78125
],
[
-74.00390625,
40.78125
],
[
-74.00390625,
40.7373046875
]
]
]
}
]
},
"properties": {
"name": "Geohash polygons collection"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment