次の方法で共有


geo_point_to_geohash()

地理的な場所の geohash 文字列値を計算します。

geohash に関する詳細をお読みください。

構文

geo_point_to_geohash(経度,緯度,[ accuracy ])

構文規則について詳しく知る。

パラメーター

名前 必須 説明
longitude real ✔️ 地理空間座標、経度値 (度単位)。 有効な値は実数で、[-180, +180] の範囲です。
latitude real ✔️ 地理空間座標、緯度の値 (度単位)。 有効な値は実数で、[-90, +90] の範囲です。
精度 int 要求された精度を定義します。 サポートされている値の範囲は [1, 18] です。 指定されない場合は、既定値の 5 が使用されます。

戻り値

要求された精度の長さを持つ、特定の地理的な場所の geohash 文字列値。 座標または精度が無効な場合、クエリは空の結果を生成します。

Note

  • Geohash は、便利な地理空間クラスタリング ツールです。
  • Geohash には、18 の精度レベルがあり、適用範囲は最高レベル 1 の 2500万 km²から最低レベル 18 の 0.6μ² です。
  • geohash の一般的なプレフィックスは、互いにポイントの近接性を示します。 共有プレフィックスが長いほど、2 つの場所が近いということになります。 精度の値は、geohash の長さに変換されます。
  • geohash は、平面上の四角形の領域です。
  • 経度 x と緯度 y で 計算された geohash 文字列に対して geo_geohash_to_central_point() 関数を呼び出しても、必ずしも x と y が返されるとは限りません。
  • geohash 定義により、2 つの地理的な場所が互いに非常に近いが、異なる geohash コードを持つ可能性があります。

精度値ごとの geohash 四角形の適用範囲:

精度 [高さ]
1 5000 km 5000 km
2 1250 km 625 km
3 156.25 km 156.25 km
4 39.06 km 19.53 km
5 4.88 km 4.88 km
6 1.22 km 0.61 km
7 152.59 m 152.59 m
8 38.15 m 19.07 m
9 4.77 m 4.77 m
10 1.19 m 0.59 m
11 149.01 mm 149.01 mm
12 37.25 mm 18.63 mm
13 4.66 mm 4.66 mm
14 1.16 mm 0.58 mm
15 145.52 μ 145.52 μ
16 36.28 μ 18.19 μ
17 4.55 μ 4.55 μ
18 1.14 μ 0.57 μ

geo_point_to_s2cell()geo_point_to_h3cell() も参照してください。

使用可能な他のグリッド システムとの比較については、「 Kusto クエリ言語を使用した地理空間クラスタリング」を参照してください。

次の例では、geohash によって集計された US Storm イベントを検索します。

StormEvents
| project BeginLon, BeginLat
| summarize by hash=geo_point_to_geohash(BeginLon, BeginLat, 3)
| project geo_geohash_to_central_point(hash)
| render scatterchart with (kind=map)

出力

geohash 別にグループ化された米国の嵐イベントのスクリーンショット。

次の例では、geohash 文字列値を計算して返します。

print geohash = geo_point_to_geohash(-80.195829, 25.802215, 8)

出力

geohash
dhwfz15h

次の例では、座標のグループを検索します。 グループ内のすべての座標ペアは、4.88 km x 4.88 km の四角形領域に存在します。

datatable(location_id:string, longitude:real, latitude:real)
[
  "A", double(-122.303404), 47.570482,
  "B", double(-122.304745), 47.567052,
  "C", double(-122.278156), 47.566936,
]
| summarize count = count(),                                          // items per group count
            locations = make_list(location_id)                        // items in the group
            by geohash = geo_point_to_geohash(longitude, latitude)    // geohash of the group

出力

geohash count locations
c23n8 2 ["A", "B"]
c23n9 1 ["C"]

次の例では、座標入力が無効であるため、空の結果が生成されます。

print geohash = geo_point_to_geohash(200,1,8)

出力

geohash

次の例では、精度入力が無効であるため、空の結果が生成されます。

print geohash = geo_point_to_geohash(1,1,int(null))

出力

geohash