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

**URL:** <https://community.thunkable.com/t/filter-data-list-viewer-based-on-my-current-location-or-a-location-that-i-select/1741294>\
**Category:** Questions about Thunkable X\
**Created:** [February 18, 2022, 9:36am UTC](https://community.thunkable.com/t/filter-data-list-viewer-based-on-my-current-location-or-a-location-that-i-select/1741294 "2022-02-18T09:36:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattpb](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mattpb](https://community.thunkable.com/u/mattpb)\
**Post date:** [February 18, 2022, 9:36am UTC](https://community.thunkable.com/t/filter-data-list-viewer-based-on-my-current-location-or-a-location-that-i-select/1741294/1 "2022-02-18T09:36:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)\
**Post date:** [February 18, 2022, 10:51am UTC](https://community.thunkable.com/t/filter-data-list-viewer-based-on-my-current-location-or-a-location-that-i-select/1741294/2 "2022-02-18T10:51:52Z")

</div>

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](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/a/3a67f0c9ba379dd9df27fea553f242804b01aaea.png)

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.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [February 18, 2022, 4:02pm UTC](https://community.thunkable.com/t/filter-data-list-viewer-based-on-my-current-location-or-a-location-that-i-select/1741294/3 "2022-02-18T16:02:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)\
**Post date:** [February 18, 2022, 7:05pm UTC](https://community.thunkable.com/t/filter-data-list-viewer-based-on-my-current-location-or-a-location-that-i-select/1741294/4 "2022-02-18T19:05:08Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [May 19, 2022, 7:05pm UTC](https://community.thunkable.com/t/filter-data-list-viewer-based-on-my-current-location-or-a-location-that-i-select/1741294/5 "2022-05-19T19:05:31Z")

</div>

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