# Sort by location

**URL:** https://community.glideapps.com/t/sort-by-location/1758
**Category:** Feature Requests
**Created:** [November 7, 2019, 8:01am UTC](https://community.glideapps.com/t/sort-by-location/1758 "2019-11-07T08:01:06Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Amy\_McPherson](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/amy_mcpherson/32/1164_2.png) [@Amy\_McPherson](https://community.glideapps.com/u/Amy_McPherson)
#### Post date: [November 7, 2019, 8:01am UTC](https://community.glideapps.com/t/sort-by-location/1758/1 "2019-11-07T08:01:06Z")

</div>

I couldn’t find if this has been asked before so apologies if it has, but does anyone know how to sort listings by location? Is this possible?

Thanks heaps 🙂

---

<div class="post-metadata">

### Author: ![Paul](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/paul/32/1345_2.png) [@Paul](https://community.glideapps.com/u/Paul)
#### Post date: [November 7, 2019, 8:23am UTC](https://community.glideapps.com/t/sort-by-location/1758/2 "2019-11-07T08:23:20Z")

</div>

Can try to help here.

What aspect of the location do you want to sort by? City, State, Country? …or proximity? (Proximity could be difficult).

---

<div class="post-metadata">

### Author: ![Amy\_McPherson](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/amy_mcpherson/32/1164_2.png) [@Amy\_McPherson](https://community.glideapps.com/u/Amy_McPherson)
#### Post date: [November 7, 2019, 8:33am UTC](https://community.glideapps.com/t/sort-by-location/1758/3 "2019-11-07T08:33:28Z")

</div>

I was hoping to use proximity

---

<div class="post-metadata">

### Author: ![JackVaughan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jackvaughan/32/49023_2.png) [@JackVaughan](https://community.glideapps.com/u/JackVaughan)
#### Post date: [November 7, 2019, 8:54am UTC](https://community.glideapps.com/t/sort-by-location/1758/4 "2019-11-07T08:54:31Z")

</div>

Yes this is not possible yet with the map layout. It’s definitely a request I’ve heard before and I’ll make sure it’s on our wishlist.

---

<div class="post-metadata">

### Author: ![Amy\_McPherson](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/amy_mcpherson/32/1164_2.png) [@Amy\_McPherson](https://community.glideapps.com/u/Amy_McPherson)
#### Post date: [November 7, 2019, 8:57am UTC](https://community.glideapps.com/t/sort-by-location/1758/5 "2019-11-07T08:57:47Z")

</div>

Thanks JackVaughan, this would be a game changer and such a powerful element to have.

---

<div class="post-metadata">

### Author: ![Paul](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/paul/32/1345_2.png) [@Paul](https://community.glideapps.com/u/Paul)
#### Post date: [November 7, 2019, 9:10am UTC](https://community.glideapps.com/t/sort-by-location/1758/6 "2019-11-07T09:10:12Z")

</div>

Bugger eh. Proximity is asking a lot of a PWA methinks given we’re operating on the bleeding edge. For now I’m staying away with even enabling it given some testing I did broke a few design elements.

---

<div class="post-metadata">

### Author: ![George\_B](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/george_b/32/534_2.png) [@George\_B](https://community.glideapps.com/u/George_B)
#### Post date: [November 7, 2019, 1:10pm UTC](https://community.glideapps.com/t/sort-by-location/1758/7 "2019-11-07T13:10:45Z")

</div>

If we had access to the users location, lat and long, and all of your addresses had those values, you could write a formula to calculate a distance between the one address and the other. I know I did that in the past, most likely in some Python code. Here is an article that shows the VB code you would use for Excel. I’m sure it could be rewritten in Google Script.

[https://www.contextures.com/excellatitudelongitude.html](https://www.contextures.com/excellatitudelongitude.html)

Just found this one that uses Google Map services.

> **[Find Distance Between Two Points with Apps Script](https://ctrlq.org/code/19735-find-distance-in-google-sheets)**
>
> Curious to know how far is location A from location B? You can put the two places in separate cells in a Google Spreadsheet and then use the getDirection() function to find the distance between the…

---

<div class="post-metadata">

### Author: ![Amy\_McPherson](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/amy_mcpherson/32/1164_2.png) [@Amy\_McPherson](https://community.glideapps.com/u/Amy_McPherson)
#### Post date: [November 7, 2019, 10:37pm UTC](https://community.glideapps.com/t/sort-by-location/1758/8 "2019-11-07T22:37:07Z")

</div>

Wow thank you! I will check it out 😀

---

<div class="post-metadata">

### Author: ![Jaybird\_Farrow](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jaybird_farrow/32/135_2.png) [@Jaybird\_Farrow](https://community.glideapps.com/u/Jaybird_Farrow)
#### Post date: [November 23, 2019, 11:10pm UTC](https://community.glideapps.com/t/sort-by-location/1758/9 "2019-11-23T23:10:55Z")

</div>

brilliant

---

<div class="post-metadata">

### Author: ![Les\_Henderson](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/les_henderson/32/1142_2.png) [@Les\_Henderson](https://community.glideapps.com/u/Les_Henderson)
#### Post date: [November 23, 2019, 11:25pm UTC](https://community.glideapps.com/t/sort-by-location/1758/10 "2019-11-23T23:25:23Z")

</div>

Then you could also feasibly create something that would display only the pins within certain ranges. 0-1 miles, 1-5, etc. in the same way you mark student grades A to F.

---

<div class="post-metadata">

### Author: ![Amy\_McPherson](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/amy_mcpherson/32/1164_2.png) [@Amy\_McPherson](https://community.glideapps.com/u/Amy_McPherson)
#### Post date: [December 3, 2020, 1:57am UTC](https://community.glideapps.com/t/sort-by-location/1758/11 "2020-12-03T01:57:16Z")

</div>

I know this topic was talked about some time ago, but just wondering if we are any closer to sort by proximity?

---

<div class="post-metadata">

### Author: ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)
#### Post date: [December 3, 2020, 2:00am UTC](https://community.glideapps.com/t/sort-by-location/1758/12 "2020-12-03T02:00:27Z")

</div>

Yes you can. Here’s how:

1. in user profile sheet, have a column for user location. Allow user to fill this in manually or use the “use my current location” component.
2. in listings sheet, create a single value column that pulls the user profile \> user location column.
3. in listings sheet, create a distance column to compare the distance between the listing location column and the single value column
4. in your app, sort the inline list by the distance column

---

<div class="post-metadata">

### Author: ![Amy\_McPherson](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/amy_mcpherson/32/1164_2.png) [@Amy\_McPherson](https://community.glideapps.com/u/Amy_McPherson)
#### Post date: [December 3, 2020, 2:10am UTC](https://community.glideapps.com/t/sort-by-location/1758/13 "2020-12-03T02:10:06Z")

</div>

would there happen to be a tutorial by any chance or an example to look at?

---

<div class="post-metadata">

### Author: ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)
#### Post date: [December 3, 2020, 2:11am UTC](https://community.glideapps.com/t/sort-by-location/1758/14 "2020-12-03T02:11:20Z")

</div>

Here’s one I made over the summer—different use case, similar setup:

> [@Distance column officially available](https://community.glideapps.com/t/distance-column-officially-available/10318/11):
>
> Two user-specific columns feeding two single value columns and one distance column allows me to filter 15000 addresses to those that are within a x-mile radius.

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [December 3, 2020, 2:15am UTC](https://community.glideapps.com/t/sort-by-location/1758/15 "2020-12-03T02:15:08Z")

</div>

@Robert_Petitto’s suggestion is good if you need the user to enter a static location, such as their home. If you instead need the proximity from a listing item to the user’s current device location, then all you need is a distance column set to compare the current location to the listing location.

Info for either method:

> **[Distance to Location](https://docs.glideapps.com/all/reference/data-editor/computed-columns/distance-to-location)**
>
> Calculate the distance between two locations

If you need the static location:

> **[Location component](https://docs.glideapps.com/all/reference/components/pickers/location-component)**
>
> Log your current location

---

<div class="post-metadata">

### Author: ![Amy\_McPherson](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/amy_mcpherson/32/1164_2.png) [@Amy\_McPherson](https://community.glideapps.com/u/Amy_McPherson)
#### Post date: [December 3, 2020, 2:21am UTC](https://community.glideapps.com/t/sort-by-location/1758/16 "2020-12-03T02:21:00Z")

</div>

Yes, Thank you! this is what I was looking at 🙂

---

<div class="post-metadata">

### Author: ![Amy\_McPherson](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/amy_mcpherson/32/1164_2.png) [@Amy\_McPherson](https://community.glideapps.com/u/Amy_McPherson)
#### Post date: [December 3, 2020, 2:36am UTC](https://community.glideapps.com/t/sort-by-location/1758/17 "2020-12-03T02:36:42Z")

</div>

Only thing is I can’t see how it is set up in the google doc, is there an example? Thanks heaps 🙂 😃

---

<div class="post-metadata">

### Author: ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)
#### Post date: [December 3, 2020, 2:45am UTC](https://community.glideapps.com/t/sort-by-location/1758/18 "2020-12-03T02:45:24Z")

</div>

You don’t set this up in the Google sheet itself, you add the column in the glide data editor.

---

<div class="post-metadata">

### Author: ![Drearystate](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/drearystate/32/49605_2.png) [@Drearystate](https://community.glideapps.com/u/Drearystate)
#### Post date: [December 3, 2020, 3:51am UTC](https://community.glideapps.com/t/sort-by-location/1758/19 "2020-12-03T03:51:41Z")

</div>

Exactly what I was gonna say, I saw the thread and thought, oh, we can fix this…Robert got ahold of it first 🙂

---

<div class="post-metadata">

### Author: ![Cisco\_Muratalla](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/cisco_muratalla/32/12358_2.png) [@Cisco\_Muratalla](https://community.glideapps.com/u/Cisco_Muratalla)
#### Post date: [February 8, 2021, 10:32pm UTC](https://community.glideapps.com/t/sort-by-location/1758/20 "2021-02-08T22:32:36Z")

</div>

appears that this feature request has been addressed with existing functionality, closing topic

[Next page](https://community.glideapps.com/t/sort-by-location/1758.md?page=2)
