# Location sensor for tracking distance

**URL:** <https://community.thunkable.com/t/location-sensor-for-tracking-distance/2983828>\
**Category:** Questions about Thunkable X\
**Created:** [May 3, 2024, 10:43pm UTC](https://community.thunkable.com/t/location-sensor-for-tracking-distance/2983828 "2024-05-03T22:43:26Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [May 4, 2024, 5:04am UTC](https://community.thunkable.com/t/location-sensor-for-tracking-distance/2983828/6 "2024-05-04T05:04:37Z")

</div>

Your “d” value in the formula1 function is returning zero. I’m not sure why but you need to fix that equation. I’d suggest starting from scratch with that line of code (not the whole formula, just the calculation for “d”).

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/3/833856e0496f393f6b987ac9111639961fff0e70.png)

I’d also base your equations off of the screenshot in this post ([Calculate distance travelled - #2 by manyone](https://community.thunkable.com/t/calculate-distance-travelled/565278/2)

Little changes you’ve made such as multiplying `app variable d` by a constant later instead of as part of the calculation of `app variable d` can have impacts that you don’t expect.

Also a note that I’ve used the Haversine formula to calculate relatively large distances like 0.5 miles but I’ve never used it for distances of just a few feet. I don’t know if it’s accurate at such small scale.   
  
·····················································································································  
Need help? [How to Ask Great Questions](https://community.thunkable.com/t/how-to-ask-great-questions-v2-0/2689983) ✨ [Debugging A Project](https://community.thunkable.com/t/debugging-in-thunkable-x-video/849471) ✨ [API JSON Tutorial](https://community.thunkable.com/t/api-json-tutorial-video/1140575)

Want to hire a Certified Thunkable Expert? [Elevate your app with Tatiang on Fiverr](https://www.fiverr.com/s/726B4a)

---

_[View the full topic](https://community.thunkable.com/t/location-sensor-for-tracking-distance/2983828)._
