# Distance from address to current users location

**URL:** <https://forum.bubble.io/t/distance-from-address-to-current-users-location/128545>\
**Category:** Need help\
**Created:** [January 2, 2021, 8:31pm UTC](https://forum.bubble.io/t/distance-from-address-to-current-users-location/128545 "2021-01-02T20:31:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![calum.work2](https://avatars.discourse-cdn.com/v4/letter/c/cdc98d/32.png) [@calum.work2](https://forum.bubble.io/u/calum.work2)\
**Post date:** [January 2, 2021, 8:31pm UTC](https://forum.bubble.io/t/distance-from-address-to-current-users-location/128545/1 "2021-01-02T20:31:27Z")

</div>

So I’m creating a directory app and I’m trying to display the current users distance from an address. I’ve tried the IP Geolocation and I can’t seem to get it to work. Any ideas on how to get the current users location and get bubble to calculate the distance to an address?

---

<div class="post-metadata">

**Author:** ![cmarchan](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/cmarchan/32/253062_2.png) [@cmarchan](https://forum.bubble.io/u/cmarchan)\
**Post date:** [January 3, 2021, 2:55am UTC](https://forum.bubble.io/t/distance-from-address-to-current-users-location/128545/2 "2021-01-03T02:55:52Z")

</div>

Hello!

Use the map element with the center map option set  
Set a field of type geographic location and call it prior location to the user data type, and a second one called current location of type geographic location  
Place a button and call it first location, a second button called current location and a third button called distance  
Build the logic so that when the button first location is pressed the maps location is recorded on the user’s field first location, also when the second button current location is pressed to record the user’s current location. You can center the maps marker by centering it in the place you want to set the respective location.  
Forgot to mention to create a number field in the user data type of type number and call it distance.  
Finally, build a workflow upon the click of the button distance to create the distance in the user’s distance number field between both locations by using the operator :distance from (this one shows if the fields locations are of type geographic location.

The above is an unrealistic way to approach it for your app but hopefully is somewhat illustrative as to how to derive the distance.

Hope this helps 👍🏻

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/bubble/original/3X/2/8/2847faa74692c2ffa5d939d3dc3724cdd060d247.png) [@system](https://forum.bubble.io/u/system)\
**Post date:** [March 13, 2021, 8:31pm UTC](https://forum.bubble.io/t/distance-from-address-to-current-users-location/128545/3 "2021-03-13T20:31:32Z")

</div>

This topic was automatically closed after 70 days. New replies are no longer allowed.
