From b366b9df6fc2cdcd637cb1e35d1128c3ece2d16f Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Thu, 4 Dec 2025 21:21:47 +0100 Subject: [PATCH] reverse: avoid interpolation lookup when result is already perfect --- src/nominatim_api/reverse.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/nominatim_api/reverse.py b/src/nominatim_api/reverse.py index a5fd1ea4..14554679 100644 --- a/src/nominatim_api/reverse.py +++ b/src/nominatim_api/reverse.py @@ -340,7 +340,9 @@ class ReverseGeocoder: # Check for an interpolation that is either closer than our result # or belongs to a close street found. - if self.max_rank > 27 and self.layer_enabled(DataLayer.ADDRESS): + # No point in doing this when the result is already inside a building, + # i.e. when the distance is already 0. + if self.max_rank > 27 and self.layer_enabled(DataLayer.ADDRESS) and distance > 0: log().comment('Find interpolation for street') addr_row = await self._find_interpolation_for_street(parent_place_id, distance) -- 2.39.5