Track Run distance not working

I am creating a Running App. I am trying to compute the distance run after Button is pressed (start running/walking) adding the distance of each segment. The next point of the segment is update every 5 seconds of walk/run getting the new location. Why is it that the “Total distance” run/walked does not appear? Did I put the blocks right?
I also would like the long number appearing in “Distance of segment” show a let’s say “1km 20m” run/walked. How to do that? Thanks

https://x.thunkable.com/projectPage/5d8383d25b08df2f222c77a1
This is my Running App project

P.S. I am not using Google Distance Matrix API because it limits the number of free API calls and for a Running App these calls have to be made often (for each segment run/walked). It also needs internet connection

Why are you converting the angles, already expressed in degree, as if they were radians?

All the trigonometric functions work with degrees. This, by itself, makes all your calculation off by nearly two order of magnitude.

1 Like

I am not good in mathematics…however I have read that even though you can use both degrees and radians in trig functions, yet, usually they have to be converted to radians in the Haversine formula (https://www.movable-type.co.uk/scripts/latlong.html).
I am not trying to convert radians to degree but degree to radians multiplying lat/long x π/180 (https://www.google.com/search?client=firefox-b-d&q=degrees+to+radians).
I am not sure 100% of what I am saying…I am just trying to follow what I read and some examples. If I am wrong please tell me where. I still cannot see the problem. Maybe you can share a pictures of how blocks should be for me to understand. Thanks

The fact that when you pull down the “sin” function from the math tool box, it comes with a preset “45” stand-in argument si already a strong hint that all the trigonometry functions in thunkable are working in degree.
You do NOT need to convert anything.
The haversine great circle function that you probably came across was possibly illustrated as Java or C language code, those programming languages utilize sinR, cosR and tanR, while thunkable use sinD, cosD and tanD.

DO NOT CONVERT ANYTHING.
The latitude and longitude from the localiser are returned in degree. The atan function would return an angle expressed in degree. All trigonometric functions are using only degree.

Ok, got it! Thanks so much.

I also make a running app now, but I it did not work properly…
Could you give me some advise for me?
(here is my project→https://x.thunkable.com/projects/600186977471a1001127ab08/ffe2fbf7-919d-44de-9b26-8cb9de074153/designer)

i will need to research but can u use accelerometer and try

Thank you, I gave it a try but I think when you work out, the position of the smartphone can be changed. So I think we can not make the use of accelerometer.

then maybe we also need to include gyroscope

I think x , y, z axis is fixed with the iphone, so we cannot use the formula. (We cannot know how users hold it)
gyroscope also use axis I think :sob: