I am trying a cycle training game concept. I don't need too much information from the geolocation, but I would like to give the player their speed and distance traveled.
I have started experimenting but get quite poor results. Maybe phones are just not able to be used in this way, although Strava / other apps seem to get usable results from just a phone.
I have a text display which is just the geolocation.speed - converted into MPH (Sorry, I am from the UK). This figure is constantly 2-3 mph our, maybe worse when in poor signal (under trees) when I compare it to my garmin watch speed.
Calculating ride distance I have tried two methods.
First I've tried getting the speed and working out time since last speed data, then using s = d x t to calculate a distance. This seems to calculate either too much or too less depending on your speed, but overall about 5-10% error compared to my watch.
The second method I tried was creating an array, then every time a location update comes in I would push into a row the long / lat and some other info. I would then use the Haversine method. I know its not 100% but I was hoping its good enough for what I want. Seems very hit / miss - almost 30% out at the moment (maybe I've messed up the calculations as its a little more complex. I couldn't get the same results as some online tools - I wondered if its rounding errors)
Has anyone done any apps like this or any thoughts on better ways to do it?
Maybe I am destined to learn how to create a Garmin IQ app instead - its just there are some smart features I thought of that would be quite easy to build in Construct once I nail bit better accuracy (say 1-3%)