Dela via


geo_geohash_neighbors()

Beräknar Geohash-grannar.

Läs mer om geohash.

Syntax

geo_geohash_neighbors(geohash)

Läs mer om syntaxkonventioner.

Parametrar

Namn Typ Obligatorisk Beskrivning
geohash string ✔️ Ett geohash-värde som det beräknades av geo_point_to_geohash(). Geohash-strängen måste vara mellan 1 och 18 tecken.

Returer

En matris med Geohash-grannar. Om Geohash är ogiltigt genererar frågan ett null-resultat.

Exempel

I följande exempel beräknas Geohash-grannar.

print neighbors = geo_geohash_neighbors('sunny')

Resultat

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

I följande exempel beräknas en matris med geohash-indata med sina grannar.

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

Resultat

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

I följande exempel beräknas Geohash polygons GeoJSON geometrisamling.

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

Resultat

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.4511718 75,23.6865234375],[42.4072265625,23.6865234375],[42.4072265625,23.642578125]]]},
{"type":"Polygon","coordinates":[[[42.4072265625,23.73046875],[42.451171875,23.73046875],[42.4511718 75,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.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"}}

I följande exempel beräknas polygonfack som representerar Geohash och dess grannar.

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)

Resultat

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]]]}

Följande exempel returnerar true på grund av ogiltiga Geohash-tokenindata.

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

Resultat

ogiltig
1