Filter Data list viewer based on my current location or a location that i select

Hi,

I have a airtable with locations with their Latitude and Longitude. I want to filter a Data Viewer List of the locations based on me for example saying show locations within 1 mile, 2 miles etc of my current location. And also the same filter but i want to set the location and not use my current location.

Thanks in advance as this community has really helped and I appreciate it.

1 Like

To do the filtering you need first convert the within 1 mile to actual coordinates and then just check each record if within those computed coordinates or not.

Ideally, you want to assume your location (or the supplied location) is the center of a circle and produce and array or coordinates of multiple points on the circumference.
image

This could be be simplifies by assuming a square instead of a circle.

This way you have two coordinates to worry about (top-left, bottom-right) and now you can start your loop through the rows of the DVL testing if the location is between these two points.

You can search the forums for the Haversine formula. If you have online access from your app, it’s easiest to use the formula in a Google Sheet. If not, you can code it using blocks and have Thunkable calculate the distance between two lat/lon pairs.

1 Like

Xano would be a great use case for something like this! You could save all your points in the backend and use their geoquery capabilities to quickly return only the relevant results!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.