Ideas on iOS GPS tracking needed

Graham Samuel livfoss at mac.com
Mon Nov 2 12:59:19 EST 2020


Sorry this is a bit long.

For a long time I’ve been tinkering with an app that uses the GPS on iPhones to show how far ‘as the crow flies’ the user is from some base point, which is set before the journey starts. It’s intended for walkers and cyclists, and I was using a beta version in the first French lockdown, which forbade one walking more than 1km from one’s house. I put the completion of this aside, but now we’re in the second French lockdown and it looks worth finishing - but I have some issues which I believe are not just down to my bad coding (though of course that’s more than possible), and I wonder if anyone else has thought about this stuff.

The basic idea is extremely simple, as you can imagine, and it wasn’t hard to code. The app keeps working out the point-to-point distance from the base and tests it against the permitted limit. If the limit is exceeded, it sounds an alarm. If the user goes back within the limit, the alarm stops. Everything else is just cosmetic, really.

The issue I have is that in every journey of say 40 minutes to an hour, the iPhone appears to generate a few ‘bad’ GPS readings. When I say bad, I mean way beyond the published accuracy of the GPS (which varies up to about 70m). Sometimes the GPS wants to tell me that I’ve walked half a kilometer in three seconds!

I have analysed a lot of data (.gpx files) from other apps for walkers, drivers and cyclists and I don’t see such glaring anomalies; and using such apps on my main test phone (an iPhone X), I don’t see these strange readings affecting the data.

Assuming this isn’t just a stupid coding error on my part (OK, a risky assumption), I need to find a solution, either by increasing the accuracy of the readings, or by finding the anomalies as they occur and eliminating them. I know no way of doing the first, and although I have ideas for the second (check apparent speed, for example), none seems foolproof. As the app works in real time, a retroactive curve-fitting solution is no good for me, even if my maths was up to coding it (Kalman filter, anyone?).

Has anyone tried anything like this, and if so, did you find any anomalies in the data, and how did you cope with them?

I’d be grateful for any ideas.

Graham



More information about the use-livecode mailing list