Verifying User Location and distance from a specific location

(This would be like a check in feature for a restaurant application or something)
I’m building a feature where a service provider needs to start a job through the app. In order to start the job, the user needs to verify that they are within 1 mile of the related job’s location. This is done by selecting a button that I’m hiding. I have a conditional on this button which is below.

I logic I’m using for this is:
when this related job's location (get distance from current user geographic position) < 1 the button is visible.

This didn’t work

I also tried to combine two APIs, the native bubble Ipiphy plugin with the IP Geo plugin. This helped me get the coordinates to the current user’s location and I can also get the coordinates for the job location but where can I compare these coordinates and verify whether the user is within a certain range of the job location?

Any help will mean a lot thanks

Bubble has the built in ‘Current geographic position’ which will always return the current position of the current user as long as they allow tracking in their browser. Then if you have the coordinates of the other location you can use the built in ‘Calculate Formula’ to get another geographic position and compare the distance between the two.
Screen Shot 2022-03-10 at 9.26.50 AM

5 Likes

Thanks this worked perfectly! Also had my location services off on my phone without knowing. Thanks again for the help!

2 Likes

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