Question

I have a location service app, in which the user's elevation is provided. I have found, though, that the elevation accuracy provided by the CLLocationManager is extremely inaccurate. When I test the same two spots twice, sometimes the elevation difference is forty feet and sometimes it is a hundred. Is there any way that I can improve the vertical accuracy of the CLLocation, or is there a different way of acquiring the user's elevation (third-party libraries)? I have already tried checking the verticalAccuracy property of the newLocation provided by the CLLocationManager and throwing it out if it isn't sufficient, but even when it is 'accurate' enough, it still often isn't actually accurate. Thanks for your time!

Right now I'm using:

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]];
}

Problems with that code: often the verticalAccuracy never gets below 30, and when it does, that is still not even close to accurate enough; I have tested the code walking around my house (one story), and it says the elevation changes up to nineteen feet, which I'm sure isn't true.

Was it helpful?

Solution

The elevation derived from GPS satellites is inherently less accurate than the horizontal solution from GPS due to the geometry of the satellites. You should expect the vertical accuracy to be usually about 1.5 to 3 times worse than the horizontal accuracy. That's just a limitation of GPS and why aviation requires WAAS correction before you can use GPS for instrument approaches.

When the vertical accuracy is 20 or 30 meters you should expect the altitude to be off up to 100 feet. Expecting it to not vary by 19 feet as you walk around the house in unrealistic.

What you could do is keep a rolling, weighted average (or a Kalman filter) of the recent "good" altitude readings to help filter out the measurement errors.

OTHER TIPS

What code have you tried? This is the best code for elevation so I don't think there is anything beyond this:

-(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";
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top