你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

geo_azimuth ()

计算从点 1 到真北线和地球上从点 1 到点 2 的直线之间的顺时针角度(以弧度为单位)。

语法

geo_azimuth(p1_longitude,p1_latitude,p2_longitude,p2_latitude)

详细了解语法约定

参数

名称 类型 必需 说明
p1_longitude real ✔️ 第一个地理空间坐标的经度值(度)。 有效值在 [-180, +180] 范围内。
p1_latitude real ✔️ 第一个地理空间坐标的纬度值(度)。 有效值在 [-90, +90] 范围内。
p2_longitude real ✔️ 第二个地理空间坐标的经度值(度)。 有效值在 [-180, +180] 范围内。
p2_latitude real ✔️ 第二个地理空间坐标的纬度值(度)。 有效值在 [-90, +90] 范围内。

返回

从点 p1 到真正的北线和线 [p1, p2] 之间的角度(以弧度为单位)。 角度是顺时针测量的。

注意

  • WGS-84 坐标参考系统表示方法对地理空间坐标进行解释。
  • 用于测量地球上的距离的大地基准是一个球体。 直线边缘是球体上的测地线
  • Azimuth 0 点以北。 Azimuth Pi/2 磅以东。 阿齐穆特皮指向南。 阿齐穆斯 3Pi/2 磅西部。
  • 如果坐标无效,则查询将生成 null 结果。
  • 如果 point1 等于 point2,则查询将生成 null 结果。
  • 如果 point1 和 point2 是反脚的,则查询将生成 null 结果。

示例

以下示例以弧度为单位计算方位角。

print azimuth_in_radians = geo_azimuth(5, 10, 10, -40)

输出

azimuth_in_radians
3.05459939796449

以下示例以度为单位计算方位角。

let azimuth_in_radians = geo_azimuth(5, 10, 10, -40);
print azimuth_in_degrees = degrees(azimuth_in_radians);

输出

azimuth_in_degrees
175.015653606568

以下示例考虑一辆卡车在行驶时发出其位置的遥测数据,并查找其行驶方向。

let get_direction = (azimuth:real)
{
    let pi = pi();
    iff(azimuth < pi/2,   "North-East",
    iff(azimuth < pi,     "South-East",
    iff(azimuth < 3*pi/2, "South-West",
                          "North-West")));
};
datatable(timestamp:datetime, lng:real, lat:real)
[
    datetime(2024-01-01T00:01:53.048506Z), -115.4036607693417, 36.40551631046261,
    datetime(2024-01-01T00:02:53.048506Z), -115.3256807623232, 36.34102142760111,
    datetime(2024-01-01T00:03:53.048506Z), -115.2732290602112, 36.28458914829917,
    datetime(2024-01-01T00:04:53.048506Z), -115.2513186233914, 36.27622394664352,
    datetime(2024-01-01T00:05:53.048506Z), -115.2352055633212, 36.27545547038515,
    datetime(2024-01-01T00:06:53.048506Z), -115.1894341934856, 36.28266934431671,
    datetime(2024-01-01T00:07:53.048506Z), -115.1054318118468, 36.28957085435267,
    datetime(2024-01-01T00:08:53.048506Z), -115.0648614339413, 36.28110743285072,
    datetime(2024-01-01T00:09:53.048506Z), -114.9858032867736, 36.29780696509714,
    datetime(2024-01-01T00:10:53.048506Z), -114.9016966527561, 36.36556196813566,
]
| sort by timestamp asc 
| extend prev_lng = prev(lng), prev_lat = prev(lat)
| where isnotnull(prev_lng) and isnotnull(prev_lat)
| extend direction = get_direction(geo_azimuth(prev_lng, prev_lat, lng, lat))
| project direction, lng, lat
| render scatterchart with (kind = map)

输出

两个连续位置之间的方位角。

以下示例返回 , true 因为第一个点等于第二个点。

print is_null = isnull(geo_azimuth(5, 10, 5, 10))

输出

is_null