I've made an application calculating distance when walking / running for iPhone.
I've compared my application to other running application, and no one gives the same distance.
Nike GPS : 2.1 Km
Runtastic : 2.5 Km
My App : 2.9 Km
Here the routing to calculate distance :
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
float distInMeter = [newLocation distanceFromLocation:oldLocation]; // which returns in meters
}
and I concatenate distInMeters
to another variable.
Why is there a such difference between those applications ? Is there another way to calculate the distance more precisely ?
Thanks for your help.
GPs positions must be filtered before calculating distances. you cannot simply sum up all distances between each location. your distance function is correct, but your filtering not. just visualize all points on the map (mkMapView), then you see that at low speeds gps creates zig-zag random error lines. from this visualisation you clearly should see why your distances are much greater.