核心位置的准确性 [英] Accuracy of Core Location

查看:165
本文介绍了核心位置的准确性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正在开发位置跟踪应用程序,并且在我的 CLLocationManager 位置更新不准确时遇到问题。这导致我的应用程序跟踪距离,这实际上只是由于GPS读数不准确造成的。



我甚至可以将我的iPhone放在桌子上,开启应用程序,几分钟后我的应用程序会跟踪数百因为这个缺陷,我们需要花费数米的距离。



这是我的初始化代码:

   - (void)initializeTracking {
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
self.locationManager.distanceFilter = 5;

[self.locationManager startUpdatingLocation];
}

预先感谢! : - )

解决方案

我在类似的应用程序中解决这个问题的方法之一是丢弃位置更新,小于该位置更新中报告的水平精度。给定一个 previousLocation ,那么对于一个 newLocation
>
计算距离 previousLocation 的距离。如果 distance> =(horizo​​ntalAccuracy * 0.5)那么我们使用了那个位置,那个位置变成了我们新的 previousLocation 。如果距离较小,我们会丢弃该位置更新,请勿更改 previousLocation 并等待下一次位置更新。



这对我们的目的很有效,你可以尝试类似的方式。如果你仍然发现噪声太多的更新,请增加0.5的因子,也许尝试0.66。



你也许还想防止你刚刚开始获得的情况一个修复程序,您可以在其中获得一系列位置更新,但似乎正在发生的是准确性正在显着提高。



我会避免以水平精度> 70米开始任何位置跟踪或距离测量。对于全球导航卫星系统来说,这些都是劣质的位置,尽管这可能是在城市峡谷,树冠厚重或其他信号不好的情况下得到的。

I'm currently working on a location tracking app and I have difficulties with inaccurate location updates from my CLLocationManager. This causes my app to track distance which is in fact only caused by inaccurate GPS readings.

I can even leave my iPhone on the table with my app turned on and in few minutes my app tracks hundreds of meters worth of distance just because of this flaw.

Here's my initialization code:

- (void)initializeTracking {
    self.locationManager = [[CLLocationManager alloc] init];
    self.locationManager.delegate = self;
    self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
    self.locationManager.distanceFilter = 5;

    [self.locationManager startUpdatingLocation];
}

Thanks in advance! :-)

解决方案

One of the ways I solved this in a similar application is to discard location updates where the distance change is somewhat less than the horizontal accuracy reported in that location update.

Given a previousLocation, then for a newLocation, compute distance from the previousLocation. If that distance >= (horizontalAccuracy * 0.5) then we used that location and that location becomes our new previousLocation. If the distance is less then we discard that location update, don't change previousLocation and wait for the next location update.

That worked well for our purposes, you might try something like that. If you still find too many updates that are noise, increase the 0.5 factor, maybe try 0.66.

You may also want to guard against cases when you are just starting to get a fix, where you get a series of location updates that appear to move but really what is happening is that the accuracy is improving significantly.

I would avoid starting any location tracking or distance measuring with a horizontal accuracy > 70 meters. Those are poor quality positions for GNSS, although that may be all you get when in an urban canyon, under heavy tree canopy, or other poor signal conditions.

这篇关于核心位置的准确性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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