geo_point_in_circle()geo_point_in_circle()

计算地理空间坐标是否在地球上的某个圆圈范围内。Calculates whether the geospatial coordinates are inside a circle on Earth.

语法Syntax

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

参数Arguments

  • p_longitude:地理空间坐标经度值(度)。p_longitude: Geospatial coordinate longitude value in degrees. 有效值为 [-180, +180] 范围内的实数。Valid value is a real number and in the range [-180, +180].
  • p_latitude:地理空间坐标纬度值(度)。p_latitude: Geospatial coordinate latitude value in degrees. 有效值为 [-90, +90] 范围内的实数。Valid value is a real number and in the range [-90, +90].
  • pc_longitude:圆心地理空间坐标经度值(度)。pc_longitude: Circle center geospatial coordinate longitude value in degrees. 有效值为 [-180, +180] 范围内的实数。Valid value is a real number and in the range [-180, +180].
  • pc_latitude:圆心地理空间坐标纬度值(度)。pc_latitude: circle center geospatial coordinate latitude value in degrees. 有效值为 [-90, +90] 范围内的实数。Valid value is a real number and in the range [-90, +90].
  • c_radius:以米为单位的圆半径。c_radius: Circle radius in meters. 有效值必须为正。Valid value must be positive.

返回Returns

指示地理空间坐标是否在某个圆圈范围内。Indicates whether the geospatial coordinates are inside a circle. 如果坐标或圆圈无效,则查询将生成 null 结果。If the coordinates or circle is invalid, the query will produce a null result.

备注

  • 按照 WGS-84 坐标参考系统表示的地理空间坐标进行解释。The geospatial coordinates are interpreted as represented by the WGS-84 coordinate reference system.
  • 用来测量地球上距离的大地测量基准是一个球体。The geodetic datum used to measure distance on Earth is a sphere.
  • 圆圈是地球上的球冠。A circle is a spherical cap on Earth. 球冠的半径沿球的曲面进行测量。The radius of the cap is measured along the surface of the sphere.

示例Examples

以下查询会查找由以下圆圈定义的区域中的所有位置:半径为 18 km,中心处于 [-122.317404, 47.609119] 坐标。The following query finds all the places in the area defined by the following circle: Radius of 18 km, center at [-122.317404, 47.609119] coordinates.

西雅图附近的位置

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
placeplace
西雅图Seattle
KirklandKirkland
RedmondRedmond

奥兰多的暴风雨事件。Storm events in Orlando. 事件在奥兰多坐标内按 100 km 进行筛选,并且按事件类型和哈希进行聚合。The events are filtered by 100 km within Orlando coordinates, and aggregated by event type and hash.

奥兰多的暴风雨事件

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 rendering available in Kusto Explorer desktop

以下示例显示在特定位置 10 米内的纽约出租车载客。The following example shows NY Taxi pickups within 10 meters of a particular location. 相关载客按哈希进行聚合。Relevant pickups are aggregated by hash.

附近的纽约出租车载客

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) // map rendering available in Kusto Explorer desktop

以下示例会返回 true。The following example will return true.

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

以下示例会返回 false。The following example will return false.

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

以下示例由于坐标输入无效而返回 null 结果。The following example will return a null result because of the invalid coordinate input.

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

以下示例由于圆半径输入无效而返回 null 结果。The following example will return a null result because of the invalid circle radius input.

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