Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QOL: Autocomplete entries sorted by distance #390

Merged

Conversation

SachsenspieltCoding
Copy link
Contributor

@SachsenspieltCoding SachsenspieltCoding commented May 22, 2024

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
Copy link
Member

karussell commented May 22, 2024

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
Copy link
Contributor Author

SachsenspieltCoding commented May 22, 2024

Ah yes, I'll look into this :)

@SachsenspieltCoding
Copy link
Contributor Author

This should do it

@karussell
Copy link
Member

karussell commented May 26, 2024

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
Copy link
Contributor Author

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

@karussell karussell merged commit e8c8c63 into graphhopper:master May 27, 2024
@karussell
Copy link
Member

Thanks!

@karussell
Copy link
Member

karussell commented May 27, 2024

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.

karussell added a commit that referenced this pull request Jun 1, 2024
ZeroGxMax pushed a commit to minhhpkp/graphhopper-maps that referenced this pull request Nov 12, 2024
* implemented

* remove debug & reformat files

* removed low-level getQueryStore().state.queryPoints

* removed obsolete import

* removed more obsolete imports

* cleaned up the Geocoder

* format file
ZeroGxMax pushed a commit to minhhpkp/graphhopper-maps that referenced this pull request Nov 12, 2024
ZeroGxMax pushed a commit to minhhpkp/graphhopper-maps that referenced this pull request Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

QOL: Sort autocomplete entries by distance
2 participants