- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我想知道如何获得 2 个 GPS 点之间的距离和方位。我研究了haversine公式。有人告诉我,我也可以使用相同的数据找到方位。
一切正常,但轴承还不能完全正常工作。轴承输出负值,但应在 0 - 360 度之间。设置数据应使水平方位96.02166666666666
并且是:
Start point: 53.32055555555556 , -1.7297222222222221
Bearing: 96.02166666666666
Distance: 2 km
Destination point: 53.31861111111111, -1.6997222222222223
Final bearing: 96.04555555555555
这是我的新代码:
from math import *
Aaltitude = 2000
Oppsite = 20000
lat1 = 53.32055555555556
lat2 = 53.31861111111111
lon1 = -1.7297222222222221
lon2 = -1.6997222222222223
lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])
dlon = lon2 - lon1
dlat = lat2 - lat1
a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2
c = 2 * atan2(sqrt(a), sqrt(1-a))
Base = 6371 * c
Bearing =atan2(cos(lat1)*sin(lat2)-sin(lat1)*cos(lat2)*cos(lon2-lon1), sin(lon2-lon1)*cos(lat2))
Bearing = degrees(Bearing)
print ""
print ""
print "--------------------"
print "Horizontal Distance:"
print Base
print "--------------------"
print "Bearing:"
print Bearing
print "--------------------"
Base2 = Base * 1000
distance = Base * 2 + Oppsite * 2 / 2
Caltitude = Oppsite - Aaltitude
a = Oppsite/Base
b = atan(a)
c = degrees(b)
distance = distance / 1000
print "The degree of vertical angle is:"
print c
print "--------------------"
print "The distance between the Balloon GPS and the Antenna GPS is:"
print distance
print "--------------------"
最佳答案
这是一个 Python 版本:
from math import radians, cos, sin, asin, sqrt
def haversine(lon1, lat1, lon2, lat2):
"""
Calculate the great circle distance in kilometers between two points
on the earth (specified in decimal degrees)
"""
# convert decimal degrees to radians
lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])
# haversine formula
dlon = lon2 - lon1
dlat = lat2 - lat1
a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2
c = 2 * asin(sqrt(a))
r = 6371 # Radius of earth in kilometers. Use 3956 for miles. Determines return value units.
return c * r
关于python - Python中的Haversine公式(两个GPS点之间的方位和距离),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4913349/
是否有机会为标记设置旋转?现在,我将 map 方位设置为一个标记的 Angular ,但其他标记应该有自己的标记方位。 目前,我正在使用这样的标记定义: var marker_el = documen
我正在尝试根据起点纬度/经度、方位角和距离找到目的地点。下面这个网站的计算器给出了我想要的结果。 http://www.movable-type.co.uk/scripts/latlong.html
大家好,我需要在我的 iPhone 应用程序中查找高度、方位和 GPS 精度。我已经在我的 Android 应用程序上完成了此操作。在android中,我是这样做的: public void onLo
第一次张贴在这里。 我正在对为桥梁检查 ROV 八旋翼飞行器收集的 GPS 数据进行一些数据分析。我们的八旋翼机在 ROS 上运行使用 3D 扫描激光雷达、立体视觉、INS 和其他一些巧妙的技术。我目
我试图通过仅以度数和距离(相对于另一个已放置的标记)指定其航向来放置标记 Google Maps API V.3。 无法在 SO 上找到任何类似的东西,在此先感谢。 最佳答案 最简单的方法是编写一个函
我是一名优秀的程序员,十分优秀!