How to only allow a button click if in Geolocation

What I would like to do is allow people to click a ‘I’m here’ button which will record them as on site, but I somehow need to only allow the click if they are say within 500yrds of a geopoint.

Is this even possible in Wappler ??

@Teodor @George sorry to tag you, but is this possible ??

1 Like

If you ask if there is an option allowing to check if coordinate X, Y is in range of XXXmeters from another location - no there is not such an option.

You will have to make the calculations yourself.

I understand that but what I want to know is if it is possible to only show a button if in that geolocation.
If so how would I do it

As i explained there is no such a built in option.

You have your user location, you have your point location. You need to do calculations yourself to check if it within a certain radius.

You can check many of the articles in google explaining how to do the maths yourself:

https://www.google.com/search?rlz=1C1CHWL_enBG821BG822&sxsrf=ALeKk02HywLYgiGR8nRcb2L-kkGZG8ivQg%3A1589373410290&ei=4um7XqaiEc-imwXYi4WQAw&q=check+if+latitude+and+longitude+is+within+a+circle+javascript&oq=check+if+latitude+and+longitude+is+within+a+circle+javascript&gs_lcp=CgZwc3ktYWIQAzIGCAAQBxAeOgQIABBHULMwWNkxYJ4zaABwAXgAgAGuAYgBsAKSAQMwLjKYAQCgAQGqAQdnd3Mtd2l6&sclient=psy-ab&ved=0ahUKEwimm6Ss7bDpAhVP0aYKHdhFATIQ4dUDCAw&uact=5

@teodor, I don’t think you are getting what I am saying.
Forget the xxx meters.

Is it possible to for a button to show when at xyz location and hidden when not at that location.
This is the question I want to know and if possible a pointer on where to start with it.

Yes @gunnery
of course it is possible to hide a button on a certain condition. This is done using dynamic show/hide attributes!

You need to make your calculations and if the user is within the radius you check - show the button, if not - hide it. Just as any other condition for showing and hiding any other element on your page.

ok I’ll have a look and play around and see if I can get it to work.
Thanks :slight_smile:

… and then tell us all how you did it :grin:

1 Like

Ok so got it working on the geolocation which was pretty easy. Just got to work out adding in the 500 meter radius. But I’m pretty confident :slight_smile:

this may help, i use this formula regularly