Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Order results by distance to specified location #2519

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 5 comments
Closed

Order results by distance to specified location #2519

openstreetmap-trac opened this issue Jul 23, 2021 · 5 comments

Comments

@openstreetmap-trac
Copy link

Reporter: kieran.fleming[at]gmail.com
[Submitted to the original trac issue database at 6.53am, Sunday, 29th November 2009]

This is about me thinking about how nominatim can benefit opensatnav (http://www.opensatnav.org) but can also definitely benefit others.
Restricting results into a bounding box doesn't really satisfy the needs of sat-nav users. What they really want is for results to be biased towards locations close to them.
For example, if the user searches for 'pub' it should return pubs in the order of distance away. If they search for 'North St' it should return results taking into account both the accuracy of the match and the distance away.
At the moment we are using OSM namefinder and it will order the results only by distance so while the first results are really close to the user they aren't a close enough match to what the user wanted.

@openstreetmap-trac
Copy link
Author

Author: twain
[Added to the original trac issue at 12.35am, Friday, 4th December 2009]

For example, if the user searches for 'pub' it should return pubs in the order of distance away. If they search for 'North St' it should return results taking into account both the accuracy of the match and the distance away.
At the moment we are using OSM namefinder and it will order the results only by distance so while the first results are really close to the user they aren't a close enough match to what the user wanted.

I've added an option to order by distance (within matching results). To use add

nearlat=[lat]&nearlon=[lon]

to the url.

I'd be be grateful for feedback on whether this meets you requirements.

@openstreetmap-trac
Copy link
Author

Author: kieran.fleming[at]gmail.com
[Added to the original trac issue at 11.12am, Monday, 7th December 2009]

It definitely meets the requirement of finding the closest pub, restaurant etc but it's not perfect for searching for specific places as it seems to be limited to a certain distance away. Here's my example:
Australian cities often have streets that have the same name as another city. The extreme example is the capital city, Canberra, which has a street for every capital city in the country!
http://www.openstreetmap.org/?lat=-35.30869&lon=149.12785&zoom=15&layers=B000FTF

If I'm in Canberra and do a search for 'Melbourne', both Melbourne Avenue, Canberra and the actual city of Melbourne should be in the results. In this case Melbourne Avenue is important because it is nearby and Melbourne is important because it is a perfect match and also because it is a large city. In contrast, Melbourne Street, North Adelaide is not useful because it's far away, not a great match and is only a street:
http://www.openstreetmap.org/?lat=-34.90877&lon=138.60684&zoom=17&layers=B000FTF

Sorry, I should've made it more clear when I put the issue in. Anyway, I hope this doesn't scare you off :)

@openstreetmap-trac
Copy link
Author

Author: twain
[Added to the original trac issue at 2.35pm, Tuesday, 8th December 2009]

Thanks for the example. I'm afraid this isn't likely to get resolved particularly quickly but is something that I'm already working on for the next version of the search.

I would expect that this will probably be released some time in the new year.

@openstreetmap-trac
Copy link
Author

Author: kieran.fleming[at]gmail.com
[Added to the original trac issue at 4.43am, Sunday, 24th October 2010]

The nearlat and nearlon parameters don't work anymore:
http://nominatim.openstreetmap.org/search?q=atm&format=xml&addressdetails=1&accept-language=en&nearlat=37.42201&nearlon=-122.0841
returns an error message. If it's too hard to get it working again please let me know and I'll switch back to bounding box.

@openstreetmap-trac
Copy link
Author

Author: lonvia
[Added to the original trac issue at 12.18pm, Saturday, 30th September 2017]

nearlat/nearlon will not be supported again. The query can now be simply formulated as 'atm near 37.42201, -122.0841'.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant