merlos / iOS-Open-GPX-Tracker

GPS Tracker app for iOS + WatchOS. Log your tracks without limits and share them; Open source GPX tracker app written in Swift
http://www.merlos.org/iOS-Open-GPX-Tracker/
GNU General Public License v3.0
605 stars 149 forks source link

Accuracy of track distances #207

Open seamusdemora opened 3 years ago

seamusdemora commented 3 years ago

I have two (2) apps I use for hiking: One is Open-GPX-Tracker, the other is Maps 3D. The past few days, I have run both apps simultaneously while taking a short hike around the neighborhood. I'm posting here because I have noticed a substantial discrepancy between the distances these two apps report.

For example, after my short hike on May 24, the distances recorded were:

  1. Open GPX Tracker: 1.56 miles
  2. Maps 3D: 1.32 miles.

I'm not obsessive about accuracy, but a difference of 15-to-18 % strikes me as too large to ignore. And this got me wondering about the potential sources of these errors. Given that the recordings were made simultaneously on the same iPhone, I am hard-pressed to identify a plausible theory that explains this.

I do not know which of the readings is more accurate, as I have no other tools to use. I'm posing essentially the same question to the Maps 3D author; if I learn anything useful there, I'll share it here. In the meantime, I'd very much like to hear any thoughts you have wrt the accuracy of your calculations.

geezerhiker commented 3 years ago

I have been working on this issue for years. I was trying to merge my research into OGT last year but gave up because I didn’t want to spend all my time figuring out how to use Github, so I wrote my own app instead.

The principal issue is that most GPS trackers record points that are far too close together. The “horizontal accuracy” measure (which is really a "horizontal error” figure) returned by CLLocationManager is usually around 5 meters on newer iPhones. Try picturing a CLLocation as a 10 meter diameter circle centered at that location rather than as a single point since the true location might be anywhere in that circle (or maybe not even inside, since that “accuracy” figure is a statistical estimate).

Thus if you accept CLLocations that are only 2 meters apart (as OGT does - manager.distanceFilter = 2 //meters) there no good reason to believe that you have moved at all or if so, in what direction. I made a drawing to illustrate this - If you move a 5 meter radius circle (red) to the right by 2 meters (blue) it looks like the left-hand drawing below:

The yellow area is the overlap - your actual location for both readings may have been anywhere in the yellow. You may not have moved at all. In order to be reasonably confident that you are not standing still you would have to move the blue circle further, as in the right-hand drawing.

You can test this very easily by building a version of OGT with the distance filter set to 9 or 10 instead of 2 and going for a long walk in the woods. (The differences would not show up as clearly if you are just walking on city streets.)

I can see no justification for ever recording trackpoints that are closer to gather than twice the “horizontal accuracy” of the points (except possibly for some special cases, like recording waypoints). It is easy to see that one might think that more points will give a more detailed track but keep this old saw in mind:

Garbage In, Garbage Out

And who wants more garbage? The first time I ran my app, called HikeTracker, alongside OGT on the same iPhone and looked at the two tracks from a distance (in Garmin BaseCamp) they appeared identical. But when you zoom in you can see all kinds of little squiggles in the OGT track, even when we were just walking along a road. Finally, both apps gave a total distance of 6.2 - but OGT said 6.2 miles and HikeTracker said 6.2 kilometers - a 40% or 60% error, depending on how you phrase it.

The difference with Maps3D is that they seem to have defaulted the distanceFilter to 12 meters (and it is adjustable by the user). In my one test I found that this was a little high - there was a tendency to clip corners. If you stick to twice the horizontal accuracy then you get pretty good tracks and realistic distances.

Al Heezen

On May 26, 2021, at 10:15 AM, Seamus @.***> wrote:

I have two (2) apps I use for hiking: One is Open-GPX-Tracker, the other is Maps 3D https://www.movingworld.de/. The past few days, I have run both apps simultaneously while taking a short hike around the neighborhood. I'm posting here because I have noticed a substantial discrepancy between the distances these two apps report.

For example, after my short hike on May 24, the distances recorded were:

Open GPX Tracker: 1.56 miles Maps 3D: 1.32 miles. I'm not obsessive about accuracy, but a difference of 15-to-18 % strikes me as too large to ignore. And this got me wondering about the potential sources of these errors. Given that the recordings were made simultaneously on the same iPhone, I am hard-pressed to identify a plausible theory that explains this.

I do not know which of the readings is more accurate, as I have no other tools to use. I'm posing essentially the same question to the Maps 3D author; if I learn anything useful there, I'll share it here. In the meantime, I'd very much like to hear any thoughts you have wrt the accuracy of your calculations.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/merlos/iOS-Open-GPX-Tracker/issues/207, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACR42KWHRKEZW7ZWN25RN7LTPUUCFANCNFSM45SQFXFA.

seamusdemora commented 3 years ago

@geezerhiker - Hello Alan, and thanks for the feedback. So many thoughts come into my mind from your post. First is to encourage you to stick with git, and not let the minutiae deter you. FWIW, I've found some good Q&A on the subject in StackOverflow site. Second is that your drawing didn't make it into your post her. Third - your research sounds interesting... I'm curious to know if you considered Kalman filtering as an approach? Fourth - 6.2 mi vs 6.2 km... which app was closest to the true distance? Fifth - thanks for the tip on Maps 3D - I'll try that! And finally - what method do you use to determine the accuracy of your trcck measurements?

housy76 commented 1 year ago

Would be great if you can fix it with the following approach: At the top of the app you built an indicator for the signal quality. If you create a menu where the user can select the minimum signal quality for a track point to be stored the problem would be solved. I‘m not good in programming but it sounds durable without many effort.

Maybe you can also add a menu to select the record interval for track-points (1s, 5s, 30s, 1min, …) maybe that extends the battery lifetime. Maybe the user can set for each of the prebuilt activity types.