This repository has been archived by the owner on Jun 8, 2024. It is now read-only.
Filter on place and amenity places to find default location #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR aims to fix bug 277: Project-OSRM/osrm-backend#277
It filters the JSON returned by Nominatim in order to avoid setting places on boundaries (which happens for most places), e.g. when searching for a town.
For now, the implementation is a bit rough, but it allows to find cities, towns, villages, amenities, etc. pretty well.
Ideally, I'm thinking of an implementation that would give a weight to classes, types, and distances from the other point (either start, end, or current view). For example, a place would get 100 points while an amenity would get 90. If the place is a country, then it would get 10 more, so 110, while a city would get 9, so 109, etc. In addition to that, distance would play a role, so that you could find a village if it's close to your start point, even if a bigger city far way bears the same name.