# Track Run distance not working

**URL:** https://community.thunkable.com/t/track-run-distance-not-working/246437
**Category:** Questions about Thunkable X
**Created:** [September 27, 2019, 2:25am UTC](https://community.thunkable.com/t/track-run-distance-not-working/246437 "2019-09-27T02:25:44Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![danielemazza67b](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/danielemazza67b/32/70808_2.png) [@danielemazza67b](https://community.thunkable.com/u/danielemazza67b)
#### Post date: [September 27, 2019, 2:25am UTC](https://community.thunkable.com/t/track-run-distance-not-working/246437/1 "2019-09-27T02:25:44Z")

</div>

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](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

---

<div class="post-metadata">

### Author: ![CBVG](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/cbvg/32/32401_2.png) [@CBVG](https://community.thunkable.com/u/CBVG)
#### Post date: [September 27, 2019, 2:57am UTC](https://community.thunkable.com/t/track-run-distance-not-working/246437/3 "2019-09-27T02:57:45Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![danielemazza67b](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/danielemazza67b/32/70808_2.png) [@danielemazza67b](https://community.thunkable.com/u/danielemazza67b)
#### Post date: [September 27, 2019, 7:58am UTC](https://community.thunkable.com/t/track-run-distance-not-working/246437/4 "2019-09-27T07:58:16Z")

</div>

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](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](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

---

<div class="post-metadata">

### Author: ![CBVG](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/cbvg/32/32401_2.png) [@CBVG](https://community.thunkable.com/u/CBVG)
#### Post date: [September 27, 2019, 12:38pm UTC](https://community.thunkable.com/t/track-run-distance-not-working/246437/5 "2019-09-27T12:38:17Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![danielemazza67b](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/danielemazza67b/32/70808_2.png) [@danielemazza67b](https://community.thunkable.com/u/danielemazza67b)
#### Post date: [September 27, 2019, 1:48pm UTC](https://community.thunkable.com/t/track-run-distance-not-working/246437/6 "2019-09-27T13:48:10Z")

</div>

Ok, got it! Thanks so much.

---

<div class="post-metadata">

### Author: ![summer7060.seedjpr](https://avatars.discourse-cdn.com/v4/letter/s/f08c70/32.png) [@summer7060.seedjpr](https://community.thunkable.com/u/summer7060.seedjpr)
#### Post date: [January 16, 2021, 4:54am UTC](https://community.thunkable.com/t/track-run-distance-not-working/246437/7 "2021-01-16T04:54:49Z")

</div>

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)

---

<div class="post-metadata">

### Author: ![eko.devs.apploroceo](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eko.devs.apploroceo/32/93147_2.png) [@eko.devs.apploroceo](https://community.thunkable.com/u/eko.devs.apploroceo)
#### Post date: [January 16, 2021, 5:27am UTC](https://community.thunkable.com/t/track-run-distance-not-working/246437/8 "2021-01-16T05:27:47Z")

</div>

> [@summer7060.seedjpr](#):
>
> [Thunkable](https://x.thunkable.com/projects/600186977471a1001127ab08/ffe2fbf7-919d-44de-9b26-8cb9de074153/designer)

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

---

<div class="post-metadata">

### Author: ![summer7060.seedjpr](https://avatars.discourse-cdn.com/v4/letter/s/f08c70/32.png) [@summer7060.seedjpr](https://community.thunkable.com/u/summer7060.seedjpr)
#### Post date: [January 16, 2021, 9:52am UTC](https://community.thunkable.com/t/track-run-distance-not-working/246437/9 "2021-01-16T09:52:57Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![eko.devs.apploroceo](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eko.devs.apploroceo/32/93147_2.png) [@eko.devs.apploroceo](https://community.thunkable.com/u/eko.devs.apploroceo)
#### Post date: [January 16, 2021, 9:57am UTC](https://community.thunkable.com/t/track-run-distance-not-working/246437/10 "2021-01-16T09:57:34Z")

</div>

then maybe we also need to include gyroscope

---

<div class="post-metadata">

### Author: ![summer7060.seedjpr](https://avatars.discourse-cdn.com/v4/letter/s/f08c70/32.png) [@summer7060.seedjpr](https://community.thunkable.com/u/summer7060.seedjpr)
#### Post date: [January 16, 2021, 10:30am UTC](https://community.thunkable.com/t/track-run-distance-not-working/246437/11 "2021-01-16T10:30:56Z")

</div>

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 😭

---

<div class="post-metadata">

### Author: ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)
#### Post date: [November 8, 2024, 12:08pm UTC](https://community.thunkable.com/t/track-run-distance-not-working/246437/12 "2024-11-08T12:08:50Z")

</div>


