From: Anton Khorev Date: Mon, 28 Apr 2025 23:11:25 +0000 (+0300) Subject: Limit number of directions endpoint geocoding results to 1 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/12206d6b7a55eea1abd8e25b3a8c6301abef620f Limit number of directions endpoint geocoding results to 1 --- 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 })