2011-11-26 117 views
9

我有一個位置服務應用程序,提供用戶的海拔。但我發現,CLLocationManager提供的高程精度非常不準確。當我測試兩個相同的兩個點時,有時海拔差異是四十英尺,有時是一百。有什麼方法可以提高CLLocation的垂直精度,還是有不同的方式來獲取用戶的高程(第三方庫)?我已經嘗試過檢查CLLocationManager提供的newLocation的verticalAccuracy屬性,如果它不夠充分,則拋出它,但即使它足夠「準確」,仍然通常實際上並不準確。謝謝你的時間!CLLocation海拔準確性

現在我使用:

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英尺,我敢肯定這是不正確的。

回答

22

從GPS衛星獲得的高程本身就不太準確,從GPS水平的解決方案,由於衛星geometry 。您應該預計垂直精度通常比水平精度差約1.5至3倍。這只是GPS的侷限性,爲什麼航空需要WAAS校正才能使用GPS進行儀表進近。

當垂直精度爲20或30米時,您應該預計高度可達100英尺。當你在房子周圍走路時,期望它不會變化19英尺,這是不現實的。

你可以做的是保持近期「良好」高度讀數的滾動加權平均值(或Kalman filter),以幫助濾除測量誤差。

+0

是的,這似乎是不幸的事實。 +1爲好的解釋和良好的聯繫。 –

2

你試過了什麼代碼? 這是海拔最好的代碼,所以我不認爲有任何超出此:

-(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"; 
} 
+0

看到我的編輯請 –

+0

我推薦的就是使用我的代碼,因爲這是iDevices可能的最佳準確度。它仍然是一部手機,由於物理限制,其準確度並不高。 –