CLLocation elevation accuracy
Asked Answered
L

2

10

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.

Larios answered 26/11, 2011 at 22:38 Comment(0)
S
28

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.

Staggers answered 29/11, 2011 at 3:36 Comment(2)
Yes, this seems to be the unfortunate truth. +1 for good explanation and good link.Larios
Even if it is worse, can it be used to differentiate flight vs road travel? Since the elevation difference would be anyway too much between two cases: https://mcmap.net/q/1161107/-cllocation-altitude-property-validity-in-flight/1364053Bordure
D
2

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";
}
Debbi answered 29/11, 2011 at 3:23 Comment(1)
What I recommend is just to use my code because this is the best accuracy possible with the iDevices. It is still a phone and the accuracy is not that great due to physical limitations.Debbi

© 2022 - 2024 — McMap. All rights reserved.