Pass viewbox to Nominatim when geocoding routing endpoints

Fixes #2327
Closes #2328
This commit is contained in:
marc tobias 2019-07-25 03:25:02 +02:00 committed by Tom Hughes
parent 81f1e7982a
commit 61faea262a

View file

@ -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(); // <sw lon>,<sw lat>,<ne lon>,<ne lat>
$.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) {