给定两个启动和停止gps坐标(即点#1:39.5210981,-76.6194347,点#2:39.620669,-76.554627),我使用OpenStreetMap获得了这两个启动和停止gps坐标之间最短路线的所有gps坐标点
问题是,我如何以给定路线每1秒的速度(即30英里/小时或45公里/小时)迭代一组新的gps坐标
我尝试使用另一个stackoverflow用户给出的代码计算两点之间的距离:
def midpoint(lat1, long1, lat2, long2, per):
return lat1 + (lat2 - lat1) * per, long1 + (long2 - long1) * per
但是对于某些点来说,它看起来很不恰当,而且,如果某些点非常接近,那么我也不恰当
我建议使用一个外部库来实现这一点,如果你想在长距离内准确地完成这一点,那么要正确地计算是相当困难的。我以前使用过} 方法,该方法说:
pyproj
,它公开了一个^{“方位角”是你头部到达该点的角度,距离以米为单位
它还公开了^{} 用于返回坐标:
我想你会想把这些放在一起是这样的:
这在短距离内给出了一条基本上是直线的曲线,但在较长距离内曲线会很明显
相关问题 更多 >
编程相关推荐