Distance from: --- to:---

Hi, I’m trying to create filter that would show results (things created by other users) in the range of two inputs (distance from: & distance to:). Just like the one you can see in the AutoScout or anywhere else where you can pick a distance from a thing. ‘From:’ would be current user location (right now I don’t know how I could know the location of the user) and ‘to:’ other user’s things location (when the user creates a thing, he provides this information). Any ideas?

I think you will need to use a map plugin to do this or an API.

Why don’t you take a look at this post.

Are you sure that it will help me, since I’m trying to show things (not on a map, in a repeating group) that are in a distance range provided by a user in ‘input min’ and ‘input max’?

You can do this search natively in Bubble:

location1 and location2 being geographic address fields.

This is a “straight line” distance measurement though, not following a particular route’s length.

How can I link it to the inputs ‘from: to:’? What should be the input’s type of value?

My screenshot I’m just searching for Users, but maybe you would be searching for

And instead of my screenshot saying Current user's location2, instead you reference Current geographic position, or some pre-inputted location saved in your database by the User when they sign up.

This is all assuming you’ve set up your Google Maps api keys in the app settings.

Or do you mean you want to search for places with a minimum value like between 2 and 5 miles, not just 0 to 5 miles?

Exactly

Well it looks like Bubble only gives us the “within” so 0 to 5 miles. But I bet you could add :minus list after the search, and do the same search but within 3 miles. Then you’re getting between 3 and 5.

The number is dynamic I just statically typed the number for the screenshot.

See if that works out for you, otherwise you might need to switch to the API Connector manually setting up API calls

There’s no way I could do something like ‘thing is within input1 min. < input2 max. value’?
Btw, I’ve got to set up Google maps API for this right?

Either way you will need to setup Google Maps API keys, let me think bout your question though if there’s a different way to do this… I’m pretty sure my :minus list way would work though

I’m pretty new to this and I’m not sure how to use the :minus list

Well my logic is Search for Things where the distance is within 5 miles, then after the search do :minus list and Search for Things where the distance is wthin 3 miles.

So you’re subtracting the ones within 3 miles from the list of things within 5 miles. :man_shrugging:

1 Like

Oh right, I’ll try that thank you!

Make sure to use the search constraints to reduce the candidate count (including current user), it could get expensive if the user list is large.

Silly joke time

:linus mist is the fog created by Linus coughing on the camera lens

2 Likes

:rofl::rofl:

I’m just glad Bubble Jesus (@mishav ) is approving of my suggestions so far

Ew, I hope that doesn’t become a thing :crazy_face:

Your suggestions are excellent btw :1st_place_medal:

1 Like

in range _ Bubble Editor – Brave 30.08.2023 18_29_46 (2)
How can I do :minus list ?

Click “Close” because that search is good, then do :minus list after the actual search

Alright, and now how can I include the current user only?