osm-search / Nominatim

Open Source search based on OpenStreetMap data
https://nominatim.org
GNU General Public License v3.0
2.98k stars 701 forks source link

Handle POIs in POIs during reverse lookup #3390

Closed lonvia closed 2 months ago

lonvia commented 2 months ago

The closest object for reverse lookups is determined via the distance between query point and object. This automatically makes area POIs win when the lookup point is inside because then the distance is 0.

This PR tries to somewhat improve the situation by looking for the two closest objects and returning the second if the first is an area and the second is a POI node that is reasonably close.

There are some corner cases that this hack doesn't cover, for example when another street happens to be closer than the point POI. These cases are anyways tricky and probably better solved by returning multiple results. The generic case of a large POI area like a shopping mall should work better with this change.

See also #2785 and #3387.

mtmail commented 2 months ago

I can confirm this fixes the issue I saw in https://github.com/osm-search/Nominatim/discussions/3387