Sort by location

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 :slight_smile:

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).

I was hoping to use proximity

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.

3 Likes

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

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.

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

Just found this one that uses Google Map services.

5 Likes

Wow thank you! I will check it out :grinning:

brilliant

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.

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

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
2 Likes

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

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

@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:

If you need the static location:

4 Likes

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

1 Like

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

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

1 Like

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

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