Compartir a través de


geo_geohash_neighbors()

Se aplica a: ✅Microsoft FabricAzure Data Explorer✅Azure MonitorMicrosoft Sentinel

Calcula vecinos geohash.

Obtenga más información sobre geohash.

Sintaxis

geo_geohash_neighbors(geohash)

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

Parámetros

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

Devoluciones

Matriz de vecinos geohash. Si geohash no es válido, la consulta genera un resultado nulo.

Ejemplos

En el ejemplo siguiente se calculan los vecinos geohash.

print neighbors = geo_geohash_neighbors('sunny')

Salida

Vecinos
["sunnt","sunpj","sunnx","sunpn","sunnv","sunpp","sunnz","sunnw"]

En el ejemplo siguiente se calcula una matriz de geohash de entrada con sus vecinos.

let geohash = 'sunny';
print cells = array_concat(pack_array(geohash), geo_geohash_neighbors(geohash))

Salida

células
["sunny","sunnt","sunpj","sunnx","sunpn","sunnv","sunpp","sunnz","sunnw"]

En el ejemplo siguiente se calcula la colección de geometrías GeoJSON de polígonos Geohash.

let geohash = 'sunny';
print cells = array_concat(pack_array(geohash), geo_geohash_neighbors(geohash))
| mv-expand cells to typeof(string)
| project polygons = geo_geohash_to_polygon(cells)
| summarize arr = make_list(polygons)
| project geojson = bag_pack("type", "Feature","geometry", bag_pack("type", "GeometryCollection", "geometries", arr), "properties", bag_pack("name", "polygons"))

Salida

geojson
{"type": "Feature","geometry": {"type": "GeometryCollection","geometries": [
{"type":"Polygon","coordinates":[[[42.451171875,23.6865234375],[42.4951171875,23.6865234375],[42.4951171875,23.73046875],[42.451171875,23.73046875],[42.451171875,23.6865234375]]]]},
{"type":"Polygon","coordinates":[[[42.4072265625,23.642578125],[42.451171875,23.642578125],[42.4511711875,23.6865234375],[42.4072265625,23.6865234375],[42.4072265625,23.642578125]]]},
{"type":"Polygon","coordinates":[[[[42.4072265625,23.73046875],[42.451171875,23.73046875],[42.451171875,23.7744140625],[42.4072265625,23.7744140625],[42.4072265625,23.73046875]]]},
{"type":"Polygon","coordinates":[[[42.4951171875,23.642578125],[42.5390625,23.642578125],[42.5390625,23.6865234375],[42.4951171875,23.6865234375],[42.4951171875,23.642578125]]]},
{"type":"Polygon","coordinates":[[[[42.451171875,23.73046875],[42.4951171875,23.73046875],[42.49511771875,23.7744140625],[42.451171875,23.7744140625],[42.451171875,23.73046875]]]},
{"type":"Polygon","coordinates":[[[42.4072265625,23.6865234375],[42.451171875,23.6865234375],[42.451171875,23.73046875],[42.4072265625,23.73046875],[42.4072265625,23.6865234375]]]},
{"type":"Polygon","coordinates":[[[[42.4951171875,23.73046875],[42.5390625,23.73046875],[42.5390625,23.7744140625],[42.4951171875,23.7744140625],[42.4951171875,23.73046875]]]},
{"type":"Polygon","coordinates":[[[42.4951171875,23.6865234375],[42.5390625,23.6865234375],[42.5390625,23.73046875],[42.4951171875,23.73046875],[42.4951171875,23.6865234375]]]},
{"type":"Polygon","coordinates":[[[[42.451171875,23.642578125],[42.4951171875,23.642578125],[42.4951171875,23.6865234375],[42.451171875,23.6865234375],[42.451171875,23.642578125]]]}]},
"properties": {"name": "polygons"}}

En el ejemplo siguiente se calculan uniones de polígono que representan Geohash y sus vecinos.

let h3cell = 'sunny';
print cells = array_concat(pack_array(h3cell), geo_geohash_neighbors(h3cell))
| mv-expand cells to typeof(string)
| project polygons = geo_geohash_to_polygon(cells)
| summarize arr = make_list(polygons)
| project polygon = geo_union_polygons_array(arr)

Salida

polígono
{"type":"Polygon","coordinates":[[[42.4072265625,23.642578125],[42.451171875,23.642578125],[42.4951171875,23.642578125],[42.5390625,23.642578125],[42.5390625,23.686523437500004],[42.5390625,23.730468750000004],[42.5390625,23.7744140625],[42.4951171875,23.7744140625],[42.451171875,23.7744140625],[42.407226562499993,23.7744140625],[42.4072265625,23.73046875],[42.4072265625,23.6865234375],[42.4072265625,23.642578125]]]}

En el ejemplo siguiente se devuelve true debido a la entrada del token Geohash no válida.

print invalid = isnull(geo_geohash_neighbors('a'))

Salida

no válido
1