跟踪位置
我有一个 GPS 跟踪器,现在工作得很好,除非 iPhone 失去了 GPS 连接。 当连接丢失时,轨道会将一个或多个点指向随机位置,如下图所示:
(来源:alluneed.it)
我可以通过什么方式丢弃这些坏价值观? 我想过这样做: 在保存数据之前,我可以对当前纬度和经度的整数值进行求和,并与旧纬度和经度的整数值进行比较;如果差异大于某个值,我会丢弃我的数据。
这会是一件好事吗? 还有其他一些不错的技巧可以做到这一点吗?
I've a GPS tracker that now works great, except when iPhone lost GPS connection.
When the connection is lost, the track makes one or more points to a random location, as you can see in this image:
(source: alluneed.it)
In which way can I discard these bad values?
I've thought about doing it this way:
before save my data, I can do a sum of my integer values of current latitude and longitude and compare with integer values of my old latitude and longitude; if the difference is bigger than some value, I discard my data.
Will it be a good thing?
Are there some other nice tricks to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
也许我发现了我的错误:
。
当我收到 kCLErrorNetwork 或除 kCLErrorDenied 之外的任何其他错误时,我执行 stopupdatinglocation 和startupdatinglocation
现在该应用程序运行良好,我明天进行一些其他测试并将结果发布在这里。
maybe i've found my fault:
in
when i receive a kCLErrorNetwork or any other error except kCLErrorDenied i perform a stopupdatinglocation and a startupdatinglocation.
Now the app works good, i make some other test tomorrow and post here the result.
尝试在 GPS 无信号时检查位置更新的时间(如果我没记错的话,位置参数中提供了时间)。
也许时间是某个常数,这样你就可以检查当前时间和位置时间之间的差异是否大于某个值,以了解该位置是否真实。
Try to check the time of the location update while the GPS has no signal (the time is provided within the location parameter if I recall correctly).
Maybe the time is some constant , and that way you can check if the difference between the current time and the location time is more then some value, to know if the location is real or not.
您可以在使用它们之前进行健全性检查。如果准确度水平突然上升然后又下降,您可以放弃这一点。如果时间戳表明用户在计算与任何先前点随时间的距离后突然以超音速移动到达新位置,则该点可能是假的。 ETC。
You can sanity check points before using them. If the accuracy level suddenly jumps up and then back down again, you can throw away that one point. If the timestamp says the user is suddenly moving at supersonic speeds to get to the new location after calculating the distance over time from any previous points, then the point is likely bogus. etc.