geo_point_in_circle()

计算地理空间坐标是否在地球上的某个圆圈范围内。

语法

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

详细了解语法约定

参数

客户 类型​​ 必需 说明
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] 坐标。

Places near Seattle.

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

输出

place
西雅图
Kirkland
Redmond

奥兰多的暴风雨事件。 事件在奥兰多坐标内按 100 km 进行筛选,并且按事件类型和哈希进行聚合。

Storm events in Orlando.

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 米内的纽约出租车载客。 相关载客按哈希进行聚合。

NY Taxi nearby Pickups.

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
1

以下示例会返回 false。

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

输出

in_circle
0

由于坐标输入无效,以下示例将返回 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