CLLocation提升精度

问题描述 投票:9回答:2

我有一个位置服务应用程序,其中提供了用户的高程。但我发现CLLocationManager提供的高程精度非常不准确。当我两次测试相同的两个点时,有时高程差是四十英尺,有时是一百。有什么办法可以提高CLLocation的垂直精度,还是有不同的方法来获取用户的高程(第三方库)?我已经尝试检查CLLocationManager提供的newLocation的verticalAccuracy属性,如果它还不够,则抛出它,但即使它足够“准确”,它仍然通常不准确。谢谢你的时间!

现在我正在使用:

if([newLocation verticalAccuracy] < 30) {
    if(isCustomary)
        altitudeLabel.text = [NSString stringWithFormat:@"%.2f feet", ([newLocation altitude] * 3.2808399)];
    else
        altitudeLabel.text = [NSString stringWithFormat:@"%.2f meters", [newLocation altitude]];
}

该代码存在问题:通常,verticalAccuracy永远不会低于30,而当它完成时,它甚至还不够准确;我测试了在我家附近行走的代码(一个故事),它说海拔高度变化到19英尺,我确信这不是真的。

ios geolocation core-location cllocationmanager altitude
2个回答
24
投票

由于卫星的geometry,从GPS卫星得到的高度本质上不如来自GPS的水平解决方案准确。您应该期望垂直精度通常比水平精度差1.5至3倍。这只是GPS的限制,为什么航空需要WAAS校正才能使用GPS进行仪表测量。

当垂直精度为20或30米时,您应该预计高度可达100英尺。当你在房子里走动时,期望不变19英尺是不现实的。

您可以做的是保持最近“良好”高度读数的滚动加权平均值(或Kalman filter),以帮助滤除测量误差。


3
投票

您尝试过哪些代码?这是提升的最佳代码,所以我认为除此之外还有什么:

-(void)awakeFromNib {
  locmanager = [[CLLocationManager alloc] init];
  [locmanager setDelegate:self];
  [locmanager setDesiredAccuracy:kCLLocationAccuracyBest];
  [locmanager startUpdatingLocation];
}

  - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
  heightMesurement.text = [NSString stringWithFormat: @"%.2f m",   newLocation.altitude];
}

  - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
  heightMesurement.text = @"0.00 m";
}
© www.soinside.com 2019 - 2024. All rights reserved.