如何计算Python中2个GPS坐标的速度,距离和方向(度)?每个点都有经纬度。Python从2个GPS坐标计算速度,距离,方向
我发现这个职位的半正矢距离计算:
Calculate distance between 2 GPS coordinates。
它也有一个速度和方向的Java版本,但它们是公制的,我需要MPH和Python。
如何计算Python中2个GPS坐标的速度,距离和方向(度)?每个点都有经纬度。Python从2个GPS坐标计算速度,距离,方向
我发现这个职位的半正矢距离计算:
Calculate distance between 2 GPS coordinates。
它也有一个速度和方向的Java版本,但它们是公制的,我需要MPH和Python。
尝试使用pyproj的时间。我必须确定一个处理LOB的项目的距离(等等),我发现pyproj是非常宝贵的。 (注意:我的积分是MGRS格式,必须首先转换为经纬度)
_GEOD = pyproj.Geod(ellps='WGS84')
_MGRS = mgrs.MGRS()
def dist(sp,ep):
try:
# convert start point and end point
(sLat,sLon) = _MGRS.toLatLon(sp)
(eLat,eLon) = _MGRS.toLatLon(ep)
# inv returns azimuth, back azimuth and distance
a,a2,d = _GEOD.inv(sLon,sLat,eLon,eLat)
except:
raise ValueError, "Invalid MGRS point"
else:
return d,a
速度您需要花费从A到B旅行的时间。Haversine可以找到距离。所以速度是微不足道的发现。在这里找到方向:http://stackoverflow.com/questions/3209899/determine-compass-direction-from-one-lat-lon-to-the-other – zengr
你一定错过了这个: http://stackoverflow.com /问题/ 15736995 /何灿I-很快,估计-的距离之间,二,经纬度点 – dappiu