From 12206d6b7a55eea1abd8e25b3a8c6301abef620f Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Tue, 29 Apr 2025 02:11:25 +0300 Subject: [PATCH] Limit number of directions endpoint geocoding results to 1 --- app/assets/javascripts/index/directions-endpoint.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/index/directions-endpoint.js b/app/assets/javascripts/index/directions-endpoint.js index 97b841f14..785613b7a 100644 --- a/app/assets/javascripts/index/directions-endpoint.js +++ b/app/assets/javascripts/index/directions-endpoint.js @@ -97,7 +97,7 @@ OSM.DirectionsEndpoint = function Endpoint(map, input, marker, dragCallback, cha function getGeocode() { const viewbox = map.getBounds().toBBoxString(), // ,,, - geocodeUrl = OSM.NOMINATIM_URL + "search?" + new URLSearchParams({ q: endpoint.value, format: "json", viewbox }); + geocodeUrl = OSM.NOMINATIM_URL + "search?" + new URLSearchParams({ q: endpoint.value, format: "json", viewbox, limit: 1 }); endpoint.geocodeRequest = new AbortController(); fetch(geocodeUrl, { signal: endpoint.geocodeRequest.signal }) -- 2.39.5