问题描述
我有以下可用的东西:
- 最后报告的时间,带有时间戳
- 目标纬度,lon
- 预计的定位时间
- 标题
如何随时间插值估算的位置?
How can I interpolate an estimated position over time?
我知道足以计算出其余旅程所需的平均速度.给定一条直线距离,这是微不足道的.我知道它与向量有关,但是我有点生疏,认为最好咨询一些专家.
I know that's enough to calculate the required average velocity for the remainder of the trip. Given a straight-line distance, it's pretty trivial. I know it has to do with vectors but I'm a bit rusty and thought it better to consult some experts.
我需要此更新速率的原因是有限的,因此,要显示流畅的动画,我需要猜测两次更新之间的当前位置.
The reason I need this update rate is limited, so to show smooth animation I need to guess at the current position between updates.
目标平台是Google Maps应用程序,因此我可以使用一些基本功能,例如针对两个坐标之间的距离进行地理校正的功能.正如我所知,语言并不重要,可以根据需要移植或改编任何示例.但是,一般的解决方案将是首选.
The target platform is a Google Maps application so I have available some basic functionality like a Geo-correct function for distance between two coordinates. Language is unimportant as I know many and can port or adapt any examples if needed. General solutions would be preferred however.
这仅仅是两个独立的向量计算吗?
Is this simply two independent vector calculations?
lat = lat + (Δ * P)
lon = lon + (Δ * P)
Where:
t = the reported estimated time to target
t = time since last time estimate
P = t / t
Δ = lat - lat
Δ = lon - lon
推荐答案
Lat_to_Travel = CurLat - TargetLat
Long_to_Travel = CurLong - TargetLong
Time_to_Travel = ETA - now
如果距离相对较小,则可以在这三个维度上假设线性变化(*).然后,您需要确定要显示的中间位置数(例如10),并相应地计算每个中间点
If the distances are relatively small, it is probably ok to assume a linear progression on these three dimensions (*). You then need to decide on a number of intermediate position to display, say 10, and calculate each intermediate point accordingly
NbOfIntermediates = 10 // for example
Lat_at_Intermediate(n) = CurLat + (1/NbOfIntermediates * Lat_to_travel)
Long_at_Intermediate(n) = CurLong + (1/NbOfIntermediates * Long_to_travel)
Time_at_Intermediate(n) = now + (1/NbOfIntermediates * Time_to_travel)
所有这些中最复杂的是保持单位正常.
The most complicated in all this is to keep the units ok.
(*)关于是否可以假定线性级数的一些考虑...
显然,物理元素的真实性的细节(海流,风,能见度...)在这方面可能比地理空间数学更重要.
假设车辆以一定的速度行驶以恒定的速度,在直线上,通常可以假定纬度维度为线性< [从技术上讲,地球并非正好是一个球体,这并不完全正确但该死的关闭].但是,在较长的距离(包括纬度的相对较大变化)上,沿经度维度的角度变化不是线性的.这样做的原因是,当我们离开赤道时,以线性英里(或公里...)表示的经度会减小.下表应针对不同纬度的位置大致了解这种影响:
( * ) A few considerations as to whether it is ok to assume a linear progression...
Obviously the specifics of the reality of the physical elements (marine currents, wind, visibility...) may matter more in this matter than geo-spatial mathematics.
Assuming that the vehicle travels at a constant speed, in a direct line, it is [generally] ok to assume linearity in the Latitude dimension [well technically the earth not being exactly a sphere this is not fully true but damn close]. However, over longer distances that include a relatively big change in latitude, the angular progression along the longitude dimension is not linear. The reason for this is that as we move away from the equator, a degree of longitude expressed in linear miles (or kilometer...) diminishes. The following table should give a rough idea of this effect, for locations at various latitudes:
Latitude Length of a Degree Approximate examples
(of longitude) in
nautical miles
0 60 Kuala Lumpur, Bogota, Nairobi
20 56.5 Mexico city, Mecca, Mumbai, Rio de Janeiro
45 42.5 Geneva, Boston, Seattle, Beijing, Wellington (NZ)
60 30 Oslo, Stockholm, Anchorage AK, St Petersburg Russia
请参见此 便捷的在线计算器 来计算特定纬度.
另一种获得这种想法的方法是,在佛罗里达州杰克逊维尔或加利福尼亚圣地亚哥的纬度方向上向东(或向西)行驶,需要经过52英里才能覆盖一定的经度.在蒙特利尔或西雅图的纬度,仅需40英里.
See this handy online calculator to calculate this for a particular latitude.
Another way to get a idea for this is to see that traveling due East (or West) at the lattitude of Jacksonville, Florida, or San Diego, California, it takes 52 miles to cover a degree of longitude; at the latitude of Montreal or Seattle, it takes only 40 miles.
这篇关于如何使用线性插值法估算两个地理坐标之间的当前位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!