Compartir vía


geo_geohash_to_polygon()

Calcula el polígono que representa el área rectangular geohash.

Obtenga más información sobre geohash.

Syntax

geo_geohash_to_polygon(geohash)

Obtenga más información sobre las convenciones de sintaxis.

Parámetros

Nombre Tipo Requerido Descripción
geohash string ✔️ Valor geohash tal y como se calculó geo_point_to_geohash(). La cadena geohash debe tener entre 1 y 18 caracteres.

Devoluciones

Polígono en formato GeoJSON y de un tipo de datos dinámico . Si la geohash no es válida, la consulta generará un resultado nulo.

Nota

Los bordes geohash son líneas rectas y no son geodesics. Si el polígono geohash forma parte de algún otro cálculo, considere la posibilidad de desnificarlo con geo_polygon_densify().

Ejemplos

print GeohashPolygon = geo_geohash_to_polygon("dr5ru");

Salida

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

En el ejemplo siguiente se ensambla la colección de geometría GeoJSON de polígonos geohash.

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

Salida

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": "Colección de polígonos Geohash"
}}

En el ejemplo siguiente se devuelve un resultado nulo debido a la entrada geohash no válida.

print GeohashPolygon = geo_geohash_to_polygon("a");

Salida

GeohashPolygon