Has anyone experience of GPS on iPhone?

Graham Samuel livfoss at mac.com
Tue May 5 05:29:37 EDT 2020

Thanks Bill for your two messages. I see from the link you gave that the LC system is (as expected) simply a wrapper for the iOS API, and indeed the term “horizontal accuracy” is actually used internally in iOS. So it’s unlikely that LC itself is adding to my problems.

I don’t have access to an entirely different GPS system - all mine are on iPhones and I’m in lockdown. Google Earth reckons my reference point is at 43.276693, 2.160029. (The curious can see where I live).

Here is a little test done by simply sitting on a bench in my garden - as far as possible, this is what Google Earth is looking at.

Another app - “MyAltitude” on my phone. Location 43.2766, 2.1601

Built-in “Compass” app. Location 43.2766, 2.1600

My app - successive calls to mobileCurrentLocation a few seconds apart differ only beyond the fourth decimal place, a typical one is 43.276732 (so 43.277), 2.160163 (so 2.1602). During this set of about 20 measurements, horizontal accuracy varied from a minimum of 5 to a maximum of 23, tending to settle down to the lower end - but on other days I’ve seen much higher maxima, certainly above 60 and very occasionally a lot more.

So the readings agree, at least to three decimal places. Presumably the accuracy is supposed to tell me the amount of wobble to expect, although it’s measured in metres, whereas longitude and latitude are not so straightforward, since the grid covers a spherical earth. Where I live (England and the South of France), the North-South distance of a second of arc (or .000278 in decimal measurement) is about 20 metres, which is perhaps acceptable in short journeys such as walks, so I need to take account of say four or five decimal places if I’m going to hope for reasonable accuracy. This certainly looks feasible - my only real problem therefore is the wild variation in horizontal accuracy that I’m seeing.

All this makes me think that I should not have a target accuracy, since I may never hit the target and my user will be waiting forever to start his or her trip. I am therefore about to modify the app so it only looks for consistency - as soon as the horizontal accuracy settles down to a value without say more than five percent of variation, I will allow the trip to start. Seems weird but it’s the best I can do. Without access to anyone else’s coding for an iOS app, I can’t see a way to improve on that strategy. Obviously I will now run tests to see how my app compared with others that measure on-the-ground trip distance, particularly for short distances. 

In case anyone else thinks this is interesting (!), I’ll report back.


> On 4 May 2020, at 16:02, Prothero-ELS via use-livecode <use-livecode at lists.runrev.com> wrote:
> Graham,
> I would want to be verifying the coordinates with another gps device. I’d also check it against apps that give lat/Lon. 
> Bill
> William Prothero
> https://earthlearningsolutions.org
>> On May 4, 2020, at 5:07 AM, Graham Samuel via use-livecode <use-livecode at lists.runrev.com> wrote:
>> I’m using GPS on iPhone using the various commands and functions available in LC. Most of this works, but I am having difficulty with the quantity “horizontal accuracy”. This can be queried via an array which is returned when mobileCurrentLocation() is executed. 
>> Looking at other iOS apps that use GPS and allow one to examine their data, I find that in my part of the world, accuracy for them is of the order of 5 metres: but when I query it using LC I get much higher numbers, indeed some of them look like nonsense, being hundreds of metres!
>> I am aware that it takes time for a GPS signal to settle down after mobileStartTrackingSensor “location” has been called, but even if I script the examination of accuracy to wait for it to settle down (I look for a run of similar or identical readings against a ‘reasonable’ criterion, such as 5 metres), it still sometimes settles on very large numbers comparatively speaking, for example it might stabilise at 65 metres. With that level of inaccuracy any cumulative use, as in working out the number of kilometres in a trip, would not be reliable.
>> I wonder if my expectation is wrong, or if there is something different about LC’s encapsulation of these iOS outputs, or if there is some other explanation.
>> In the short term, I’m simply going to have to relax my search for a reasonable accuracy of the order of 5 metres, and just go for the first run of stable readings. But I would love to hear any further insight from anyone who’s already tried it.
>> Graham
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

More information about the use-livecode mailing list