geo_geohash_to_polygon()

Calculates the polygon that represents the geohash rectangular area.

Read more about geohash.

Syntax

geo_geohash_to_polygon(geohash)

Learn more about syntax conventions.

Parameters

Name Type Required Description
geohash string ✔️ A geohash value as it was calculated by geo_point_to_geohash(). The geohash string must be between 1 and 18 characters.

Returns

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

Note

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

Examples

print GeohashPolygon = geo_geohash_to_polygon("dr5ru");

Output

GeohashPolygon
{
"type": "Polygon",
"coordinates": [
[[-74.00390625, 40.7373046875], [-73.9599609375, 40.7373046875], [-73.9599609375, 40.78125], [-74.00390625, 40.78125], [-74.00390625, 40.7373046875]]]
}

The following example assembles GeoJSON geometry collection of geohash polygons.

// 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 bag_pack(
    "type", "Feature",
    "geometry", bag_pack("type", "GeometryCollection", "geometries", geohash_polygon_lst),
    "properties", bag_pack("name", "Geohash polygons collection"))

Output

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

The following example returns a null result because of the invalid geohash input.

print GeohashPolygon = geo_geohash_to_polygon("a");

Output

GeohashPolygon