Filter Based on Geolocation

I am building an event app. I have a map and repeating group on the page. I’d like for the app, on page load, to show events in the person’s area (geolocation). Similar to how Google shows you restaurants in your area when you type in the name of a restaurant. I’m having a hard time figuring this out. Does anyone have experience with this that could help me?

1 Like

Hi @cfisher440 :slight_smile: One way to do this would be to use the ‘Searchbox’ element which automatically detects the User’s ‘current geographic position’, or searches for other addresses depending on what the User types in:

Then you can set the center point of the map to be the location entered in the Searchbox:

To only show Events near that location (for example, within 50 miles), you can add a search constraint in the “Do a Search for Events” expression, which shows Events within 50 miles of the searchbox’s location:

And the repeating group below would have the same data source as the map:

If the User doesn’t allow the browser to detect their location, the searchbox will be empty and all Events will show:

Preview:

Editor:

4 Likes

Wow! Thank you, thank you, thank you! Very helpful :grinning :smile:

2 Likes

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