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 結果。
範例
下列範例會尋找下列圓形所定義區域中的所有位置:18 km 的半徑,位於 [-122.317404,47.609119] 坐標。
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
輸出
下列範例顯示特定位置 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 |
---|
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應