根据步行速度在2个GPS位置之间进行插值 [英] Interpolate between 2 GPS locations based on walking speed

查看:517
本文介绍了根据步行速度在2个GPS位置之间进行插值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:






给定两个地点:$ b​​
$ b

L 1 =(latitude 1 ,longitude 1 ,timestamp 1 强度> L 2 = <纬度2>,经度<2>,时间戳<2> , p>

以及可配置但恒定的移动速度:
$ b v = 1.39米每秒(例如)。

我们如何在这两个位置之间进行插值来估计用户在从 L 1 L 2 一直在寻找这个问题的解决方案,到目前为止,我发现,对于小距离(远离极点),可以使用线性插值。因此,我在维基百科上查找了

解决方案


我猜我必须计算一些时间deltas,但是我的b $ b因子在移动速度上如何?


在线性插值中,在casem中,时间点,使用从开始时间t1到结束时间t2运行的迭代变量t,具有预定义的步骤。
Asume step = 1秒,这对您的应用程序非常有用。

  long t1 = location1.getTimeStamp() ; //以毫秒为单位; 
long t2 = location2.getTimeStamp();
double deltaLat = location2.latitude - location1.latitude;
doule deltaLon = location2.longitude- location1.longtude;
//如果您没有测量速度,则删除此行:
double deltaSpeed = location2.speed - location1.speed;

长步长= 1 * 1000; // 1秒以毫秒为单位
(长t = t1; t1
// t0_1应在该循环中从0.0到(接近)1.0运行
double t0_1 =(t-t1)/(t2 - t1);
双latInter = lat1 + deltaLat * t0_1;
double lonInter = lon1 + deltaLon * t0_1;
//如果你没有速度
double speedInter = speed1 + deltaSpeed * t0_1;
Location interPolLocation = new Location(latInter,lonInter,speedInter);
//添加interPolLocation列表或绘图。
}


Problem:


Given two locations:

L1 = (latitude1, longitude1, timestamp1), L2 = (latitude2, longitude2, timestamp2),

and a configurable, but constant, movement speed:

v = 1.39 meters per second (for instance).

How can we interpolate between these two locations to estimate a users location as he travels from L1 to L2?


I have been searching for solutions to this problem and so far I have found, that for small distances (away from the poles) linear interpolation can be used. So, I looked up linear interpolation on Wikipedia and found this:

// Imprecise method which does not guarantee v = v1 when t = 1,
// due to floating-point arithmetic error.
float lerp(float v0, float v1, float t) {
    return v0 + t*(v1-v0);
}

So I am thinking of using this lerp function to interpolate latitude and longitude between L1 and L2. That was the easy part. How do I calculate t? I'm guessing I have to calculate some time deltas, but how do I factor in the movement speed?


Edit:

I'm testing various methods for collecting GPS-locations. For this purpose, I am recording waypoint-locations throughout a walk. I need to interpolate between these waypoints, using the movement speed, to estimate my position along the walk. Then I can compare my results to the estimates to see how well they are faring.

Example:

解决方案

I'm guessing I have to calculate some time deltas, but how do I factor in the movement speed?

At linear interpolation, in your casem you iterate between two time points, using the iteration variable t which runs from start time t1 to end time t2, with a predefined step. Asume step = 1 second, which is quite usable for your application.

long t1 = location1.getTimeStamp(); // in milliseconds;
long t2 = location2.getTimeStamp();
double deltaLat = location2.latitude - location1.latitude;
doule deltaLon =  location2.longitude- location1.longtude;
// remove this line if you don't have measured speed:
double deltaSpeed =  location2.speed - location1.speed;

long step = 1 * 1000; // 1 second in millis 
for (long t = t1; t1 < t2; t+= step) {

   // t0_1 shall run from 0.0 to (nearly) 1.0 in that loop
  double t0_1 = (t - t1) / (t2 - t1);
  double latInter = lat1 + deltaLat  * t0_1;
  double lonInter = lon1 + deltaLon  * t0_1;
  // remove the line below if you dont have speed
  double speedInter = speed1 + deltaSpeed  * t0_1;
  Location interPolLocation = new Location(latInter, lonInter, speedInter);
  // add interPolLocation to list or plot.
}

这篇关于根据步行速度在2个GPS位置之间进行插值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆