From: marc tobias Date: Thu, 25 Jul 2019 01:25:02 +0000 (+0200) Subject: Pass viewbox to Nominatim when geocoding routing endpoints X-Git-Tag: live~2434 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/61faea262a5b75ddca7035daa68239a1f0c54d05 Pass viewbox to Nominatim when geocoding routing endpoints Fixes #2327 Closes #2328 --- diff --git a/app/assets/javascripts/index/directions.js b/app/assets/javascripts/index/directions.js index 4f79ca471..4c39d6781 100644 --- a/app/assets/javascripts/index/directions.js +++ b/app/assets/javascripts/index/directions.js @@ -105,7 +105,9 @@ OSM.Directions = function (map) { endpoint.awaitingGeocode = true; - $.getJSON(OSM.NOMINATIM_URL + "search?q=" + encodeURIComponent(endpoint.value) + "&format=json", function (json) { + var viewbox = map.getBounds().toBBoxString(); // ,,, + + $.getJSON(OSM.NOMINATIM_URL + "search?q=" + encodeURIComponent(endpoint.value) + "&format=json&viewbox=" + viewbox, function (json) { endpoint.awaitingGeocode = false; endpoint.hasGeocode = true; if (json.length === 0) {