From 908232d397d16d955fea85e87895fbf81ae56b70 Mon Sep 17 00:00:00 2001 From: Arne Schwarck Date: Sat, 25 Jan 2025 22:11:35 +0100 Subject: [PATCH] Fix reverse geocoding issue Previously, reverse geocoding queries in the Photon lookup did not properly limit results within a specified search radius, leading to inaccurate or unexpected locations being returned. This fix ensures that the :radius parameter is passed directly, just like :limit and :distance_sort, instead of being nested under :params. By aligning with the Photon lookup implementation in Geocoder, this change improves accuracy and ensures that results are correctly filtered based on proximity, resolving issues where points were incorrectly matched due to missing radius constraints. Resolves: Reverse geocoding mismatch for close proximity queries --- app/services/reverse_geocoding/places/fetch_data.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/reverse_geocoding/places/fetch_data.rb b/app/services/reverse_geocoding/places/fetch_data.rb index 17a0dad0..12186c9f 100644 --- a/app/services/reverse_geocoding/places/fetch_data.rb +++ b/app/services/reverse_geocoding/places/fetch_data.rb @@ -96,7 +96,7 @@ class ReverseGeocoding::Places::FetchData end def reverse_geocoded_places - data = Geocoder.search([place.latitude, place.longitude], limit: 10, distance_sort: true, params: { radius: 10 }) + data = Geocoder.search([place.latitude, place.longitude], limit: 10, distance_sort: true, radius: 10) data.reject do |place| place.data['properties']['osm_value'].in?(IGNORED_OSM_VALUES) ||