BimmerGestalt / AAIdrive

Implementations of some Android Auto features as unofficial IDrive apps
MIT License
541 stars 90 forks source link

Suggestion: Add geolocation bias to places search #569

Closed bogdan-calapod closed 2 years ago

bogdan-calapod commented 2 years ago

Hey there,

The custom Mapbox implementation works great, but one thing that I'm having a bit of a hard time with is the fact that, when searching, destinations in location thousands of kilometers away from me show up, making it hard to filter out the ones close to me that I'm actually interested into.

From what I've researched I've found that mapbox can bias the search results to a certain region. I'm thinking that adding a toggle to bias the search results to the location of the user (+ a certain range, let's say 100km) would go a long way to improving the search result functionality (and also reducing the API calls maybe, due to fewer erroneus searches ?)

Alternatively, I'm thinking that pasting a Google Maps URL somewhere and extracting the GPS coordinates from that would also work, but maybe I should make a separate issue with this

Thanks for a great app!

hufman commented 2 years ago

Good morning, and thank you for the suggestion! The code already sends the proximity option to hint to Mapbox to prioritize nearby results. I just added unit tests to be sure, besides the manual testing when I built it.

Are you searching through the Navigation tab or through the car interface? The Navigation tab uses the cached car location (as seen from the Car Information tab, check that your car provides that data), while the car interface uses the map's icon location (either the car location or the GPS location depending on the state of the checkbox).

If you have a (free) Mapbox account, can you play around in the api playground to see if their search api provides the expected results there? I believe I'm sending the right parameters, and the app shows the closest Starbucks for me, so I'm not sure why it's not behaving as expected for you.

hufman commented 2 years ago

For your second question, you can share a Google Maps location to AAIdrive while it's connected to the car and it parses out the destination information as you mention. In fact, the code is shared and you could actually paste a Google Maps link right into the Navigation search box and it will work too.

bogdan-calapod commented 2 years ago

In fact, the code is shared and you could actually paste a Google Maps link right into the Navigation search box and it will work too.

Ah, I didn't know that - nice, will come in handy. Does pasting Google Maps links to the "Favorite Destinations" input work as well ?

If you have a (free) Mapbox account, can you play around in the api playground to see if their search api provides the expected results there? I believe I'm sending the right parameters, and the app shows the closest Starbucks for me, so I'm not sure why it's not behaving as expected for you.

I'll play around with it - for me for certain searches it is retrieving one or two POIs close to me, then something way over in Bangladesh. Maybe it's not finding anything in between and falling back on that ?

Are you searching through the Navigation tab or through the car interface?

Navigation tab in the app - I find it a bit difficult to type with the iDrive controller

hufman commented 2 years ago

Indeed, the favorite places are just strings and should work, though ugly! I can't guarantee the search quality of this service, I apologize 😬

bogdan-calapod commented 2 years ago

Okay, then I think we can close this issue :D