KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to build an iOS app that displays the total distance travelled when running or walking. I've read and re-read all the documentation I can find, but I'm having trouble coming up with something that gives me an accurate total distance. When compared with Nike+ GPS or RunKeeper, my app consistently reports a shorter distance. They'll report the same at first, but as I keep moving, the values of my app vs other running apps gradually drift. For example, if I walk .3 kilometers (verified by my car's odometer), Nike+ GPS and RunKeeper both report ~.3 kilometers every time, but my app will report ~.13 kilometers. newLocation.horizontalAccuracy is consistently 5.0 or 10.0. Here's the code I'm using. Am I missing something obvious? Any thoughts on how I could improve this to get a more accurate reading? #define kDistanceCalculationInterval 10 // the interval (seconds) at which we calculate the user's distance #define kNumLocationHistoriesToKeep 5 // the number of locations to store in history so that we can look back at them and determine which is most accurate #define kValidLocationHistoryDeltaInterval 3 // the maximum valid age in seconds of a location stored in the location history #define kMinLocationsNeededToUpdateDistance 3 // the number of locations needed in history before we will even update the current distance #define kRequiredHorizontalAccuracy 40.0f // the required accuracy in meters for a location. anything above this number will be discarded - (id)init { if ((self = [super init])) { if ([CLLocationManager locationServicesEnabled]) { self.locationManager = [[CLLocationManager alloc] init]; self.locationManager.delegate = self; self.locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation; self.locationManager.distanceFilter = 5; // specified in meters } self.locationHistory = [NSMutableArray arrayWithCapacity:kN
Tags (comma-separated)
Save Edits
Cancel