Share via


geo_point_in_circle()

計算地理空間座標是否位於地球的圓形內。

語法

geo_point_in_circle(p_longitude,p_latitude,pc_longitude,pc_latitude,c_radius)

深入瞭解 語法慣例

參數

名稱 類型 必要 Description
p_longitude real ✔️ 地理空間座標經度值,以度為單位。 有效的值為實數,在範圍 [-180,+180] 中。
p_latitude real ✔️ 地理空間座標緯度值,以度為單位。 有效的值為實數,在範圍 [-90,+90] 中。
pc_longitude real ✔️ 圓形中心地理空間座標經度值,以度為單位。 有效的值為實數,在範圍 [-180,+180] 中。
pc_latitude real ✔️ 圓形中心地理空間座標緯度值,以度為單位。 有效的值為實數,在範圍 [-90,+90] 中。
c_radius real ✔️ 以公尺為單位的圓形半徑。 有效值必須是正數。

傳回

指出地理空間座標是否在圓形內。 如果座標或圓形無效,查詢會產生 Null 結果。

注意

  • 地理空間座標會以 WGS-84 座標參考系統的表示來解讀。
  • 用來測量地球距離的測量基準是球體。
  • 圓形是地球上的球體端點。 端點的半徑是沿著球體的表面來測量。

範例

下列範例會尋找下列圓形所定義區域中的所有位置:18 km 的半徑,位於 [-122.317404,47.609119] 坐標。

地圖的螢幕快照,其中位於西雅圖 18 公里內的位置。

datatable(longitude:real, latitude:real, place:string)
[
    real(-122.317404), 47.609119, 'Seattle',                   // In circle 
    real(-123.497688), 47.458098, 'Olympic National Forest',   // In exterior of circle  
    real(-122.201741), 47.677084, 'Kirkland',                  // In circle
    real(-122.443663), 47.247092, 'Tacoma',                    // In exterior of circle
    real(-122.121975), 47.671345, 'Redmond',                   // In circle
]
| where geo_point_in_circle(longitude, latitude, -122.317404, 47.609119, 18000)
| project place

輸出

地點
西雅圖
Kirkland
Redmond

下列範例會在 Orlando 中尋找 storm 事件。 事件會在奧蘭多座標內以 100 公里進行篩選,並依事件類型和雜湊進行彙總。

StormEvents
| project BeginLon, BeginLat, EventType
| where geo_point_in_circle(BeginLon, BeginLat, real(-81.3891), 28.5346, 1000 * 100)
| summarize count() by EventType, hash = geo_point_to_s2cell(BeginLon, BeginLat)
| project geo_s2cell_to_central_point(hash), EventType, count_
| render piechart with (kind=map) // map pie rendering available in Kusto Explorer desktop

輸出

以地圖上餅圖點呈現的 Orlando 中 Storm 事件的螢幕快照。

下列範例顯示特定位置 10 公尺內的紐約市計程車取貨。 相關的載客率會依雜湊進行彙總。

nyc_taxi
| project pickup_longitude, pickup_latitude
| where geo_point_in_circle( pickup_longitude, pickup_latitude, real(-73.9928), 40.7429, 10)
| summarize by hash = geo_point_to_s2cell(pickup_longitude, pickup_latitude, 22)
| project geo_s2cell_to_central_point(hash)
| render scatterchart with (kind = map)

輸出

呈現的地圖螢幕快照,其中顯示附近紐約市計程車取貨,如查詢中所定義。

下列範例會傳回 true

print in_circle = geo_point_in_circle(-122.143564, 47.535677, -122.100896, 47.527351, 3500)

輸出

in_circle
true

下列範例會傳回 false

print in_circle = geo_point_in_circle(-122.137575, 47.630683, -122.100896, 47.527351, 3500)

輸出

in_circle
false

由於座標輸入無效,下列範例將傳回 Null 結果。

print in_circle = geo_point_in_circle(200, 1, 1, 1, 1)

輸出

in_circle

下列範例會傳回 Null 結果,因為圓形半徑輸入無效。

print in_circle = geo_point_in_circle(1, 1, 1, 1, -1)

輸出

in_circle