python计算GPS两点之间的中间点
2018-07-20 来源:open-open
import math
def midpoint(x1, y1, x2, y2):
#Input values as degrees
#Convert to radians
lat1 = math.radians(x1)
lon1 = math.radians(x2)
lat2 = math.radians(y1)
lon2 = math.radians(y2)
bx = math.cos(lat2) * math.cos(lon2 - lon1)
by = math.cos(lat2) * math.sin(lon2 - lon1)
lat3 = math.atan2(math.sin(lat1) + math.sin(lat2), \
math.sqrt((math.cos(lat1) + bx) * (math.cos(lat1) \
+ bx) + by**2))
lon3 = lon1 + math.atan2(by, math.cos(lat1) + Bx)
return [round(math.degrees(lat3), 2), round(math.degrees(lon3), 2)]
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点!
本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。
上一篇: python写的翻译脚本
下一篇:实现查找文件的Python脚本
最新资讯
热门推荐