geo_geohash_neighbors()

Calcola i vicini Geohash.

Altre informazioni su geohash.

Sintassi

geo_geohash_neighbors(geohash)

Altre informazioni sulle convenzioni di sintassi.

Parametri

Nome Tipo Obbligatoria Descrizione
geohash string ✔️ Valore geohash calcolato da geo_point_to_geohash(). La stringa geohash deve essere compresa tra 1 e 18 caratteri.

Restituisce

Matrice di vicini Geohash. Se Geohash non è valido, la query genera un risultato Null.

Esempio

Nell'esempio seguente vengono calcolati i vicini Geohash.

print neighbors = geo_geohash_neighbors('sunny')

Output

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

Nell'esempio seguente viene calcolata una matrice di input Geohash con i relativi vicini.

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

Output

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

Nell'esempio seguente vengono calcolati i poligoni GeoHash GeoJSON.

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

Output

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.451171875,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.539062 5,23.6865234375],[42.4951171875,23.6865234375],[42.4951171875,23.642578125]]]},
{"type":"Polygon","coordinates":[[42.451171875,23.73046875],[42.4951171875,23.73046875],[42.4951171875,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"}}

Nell'esempio seguente vengono calcolate le unioni poligono che rappresentano Geohash e i relativi vicini.

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)

Output

polygon
{"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]]]}

L'esempio seguente restituisce true a causa dell'input del token Geohash non valido.

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

Output

non valido
1