X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/492a6405306092c39c26b4f6cc8b2e793ee22d43..e731dd71a77ad4ad1e9db22535e89444bb98e5d9:/app/assets/javascripts/index/directions.js diff --git a/app/assets/javascripts/index/directions.js b/app/assets/javascripts/index/directions.js index 4f65acdea..4c39d6781 100644 --- a/app/assets/javascripts/index/directions.js +++ b/app/assets/javascripts/index/directions.js @@ -1,7 +1,10 @@ //= require_self //= require_tree ./directions +//= require querystring OSM.Directions = function (map) { + var querystring = require("querystring-component"); + var awaitingGeocode; // true if the user has requested a route, but we're waiting on a geocode result var awaitingRoute; // true if we've asked the engine for a route and are waiting to hear back var chosenEngine; @@ -102,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) {