PYTHON已知起点经纬度及两点间距离、方位角如何求出终点经纬度?

最近遇到一个需求,使用pyhon 获取雷达设备中的数据并解析,将返回数据中包含方位角、速度、距离等,需要使用获得的数据来计算目标经纬度!

import math

lon = 23.1090329023218
lat = 113.64838778972626
l_azimuth = 23
l_distance = 0.5  # km


# 已知起点经纬度,使用距离与方位角求终点经纬度
def get_destination(lat1: float, lon1: float, azimuth: float, distance: float) -> list:
    """
    已知起点经纬度,使用距离与方位角求终点经纬度
    :param lat1: 已知纬度
    :param lon1: 已知经度
    :param azimuth: 已知方位角 °
    :param distance: 已知距离 km
    :return: 终点经纬度
    """
    lat1 = math.radians(lat1)
    lon1 = math.radians(lon1)
    azimuth = math.radians(azimuth)
    distance = distance / 6378.1
    lat2 = math.asin(math.sin(lat1) * math.cos(distance) + math.cos(lat1) * math.sin(distance) * math.cos(azimuth))
    lon2 = lon1 + math.atan2(math.sin(azimuth) * math.sin(distance) * math.cos(lat1),
                             math.cos(distance) - math.sin(lat1) * math.sin(lat2))
    lat2 = math.degrees(lat2)
    lon2 = math.degrees(lon2)
    return [lat2, lon2]


print(get_destination(lon, lat, 2.1, l_distance))


# 生成经纬度坐标并输出JS语句应用到地图上
for i in range(0, 8):
    z = get_destination(lon, lat, (i + 1) * 45, l_distance)
    print('L.marker([%s, %s]).addTo(map).bindPopup("角度:%d°<br />距离:%f米");' % (z[0], z[1], (i + 1) * 45, l_distance * 1000))

放进地图的效果:45度切分

模拟雷达目标显示到地图

 

  • 5
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

TBOAI

你的鼓励是我最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值