graphhopper / graphhopper-maps

GraphHopper Maps - Open Source Route Planner UI
https://graphhopper.com/maps/
Apache License 2.0
94 stars 34 forks source link

QOL: Autocomplete entries sorted by distance #390

Closed SachsenspieltCoding closed 5 months ago

SachsenspieltCoding commented 6 months ago

Since I found it quite annoying that the autocompletion was always based on the coordinate 0,0, I implemented that if there is a query point above the currently selected one, these coordinates are sent together with the geocode request to the GraphHopper Geocoding API.

fixes #385

karussell commented 6 months ago

Nice! Great idea to improve the auto complete based on previous coordinates!

Is it somehow possible to avoid using the "lower level" getQueryStore().state and e.g. inject the queryPoints into the Geocoder class directly somehow? (Currently we are fully aware of these store singletons, but never use them for inter-class dependencies)

SachsenspieltCoding commented 6 months ago

Ah yes, I'll look into this :)

SachsenspieltCoding commented 5 months ago

This should do it

karussell commented 5 months ago

Nice, thank you!

Now that I see the code: it could make more sense to pass only the point to the geocoder request method (the geocoder API stays "cleaner" like request(queryString, biasPoint, providerType)) and do the extraction of the point from the QueryPoints array once in AddressInputProps (?)

Sorry for the hassle...

SachsenspieltCoding commented 5 months ago

I've moved the logic part out of the Geocode class, could you check if this is what you had in mind?

karussell commented 5 months ago

Thanks!

karussell commented 5 months ago

Have increased the location_bias_scale to reduce hiding results. E.g. when I first entered the location "Dresden", then "hoyer" should give us not only streets in "Dresden". Let's see if it still makes problems.