Google位置客户端优化不准确/错误的位置更新

时间:2016-12-14 06:58:08

标签: android optimization google-location-services

我正在创建一个android函数,用于保存我的客户端登录到我的应用程序时所经历的路径路径。有点像优步跟踪骑行路径。

大部分时间都可以正常工作,就像我之前提到过的许多人一样,GoogleLocationclient API有时会在其“onLocationChanged”函数中返回“BAD”位置。

让我定义“BAD”位置: - 这些是在LocationRequest.setPriority = LocationRequest.PRIORITY_HIGH_ACCURACY并且返回的Location具有Location.getAccuracy()<时获取的位置更新。 50,但距实际当前位置1000多米。

因此,为了解决这个问题,我设置了一个3点队列,它缓存3个连续的位置更新,并将它们相互比较,只有当它到第1和第3个位置的距离小于它们之间的位置时才保存中间位置。第1点和第3点。

当两个准确点之间只弹出一个错误点时,此方法可以正常工作。

我的问题

当连续接收到多于2个“BAD”位置时,此逻辑无法过滤掉错误的位置,并且未来的点未得到验证。 :(

有人可以建议: - a)优化位置更新过滤的算法

                     or

b)在收集旅行的所有位置点后过滤掉“BAD”位置的算法。

非常感谢任何帮助。如果这是一个重复的问题,请原谅我的疏忽并将我链接到原始的:)。

TIA。

1 个答案:

答案 0 :(得分:1)

我会尝试以下方法:

1) Save a timestamp with every location point. 
2) Now calculate the movement speed between your actual point and your last point based on the timestamp and the location points
3) If the movement speed is higher than what is possible -> throw this point away / else keep him and move on