How to Connect Two User's based on distance

Hello! I am developing a sort of “Uber Clone”. I am differentiating drivers and customers based on an “Approved Driver” data field of “Yes/No” under the User data type. By default it is “no” and since I know all of my drivers I am planning on manually changing their “Approved Driver” status to “Yes” on the backend. When a customer presses the “Confirm” button on their request page, I am having trouble with 2 things. 1) Searching for Users based on their “Approved Driver” status being “Yes” and 2) Connecting them with this nearest Driver. I have the Google Maps Extended API set up and functioning properly.

If you have your Google Maps API key set in your app settings, you can Search for Drivers, constraint [geographical address field] is within [distance] [unit] of Current user's [geographical address field]

Then whatever determines a driver being a approved driver, include that as a constraint as well

This would be like a dummy-radius check, not actually routing using real street distance, you could make the radius bigger, then do a Route API or Distance Matrix API request and pick closest drivers that way :slightly_smiling_face:

Where exactly would I add this? I have been trying to do this in the workflow of the User’s “Confirm” button by Creating a New “Trip” (data field) and updating the Driver = Search for User’s Current Location within 50 miles Current User’s Current Location. But I get an error message saying that the “Value should be a User but right now it is a List of Users”

The search gives you a list, so you need to sort by distance and pick the closet one:

This topic was automatically closed after 70 days. New replies are no longer allowed.