X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/a997690897b765ec763631c31b9e4ca87b4e530f..3ef8024b1d33f0de6227a26967ba78ef85672a94:/app/assets/javascripts/routing_engines/mapquest.js diff --git a/app/assets/javascripts/routing_engines/mapquest.js b/app/assets/javascripts/routing_engines/mapquest.js index f31a84458..3e6e0c3fc 100644 --- a/app/assets/javascripts/routing_engines/mapquest.js +++ b/app/assets/javascripts/routing_engines/mapquest.js @@ -47,11 +47,11 @@ MapQuestEngine.prototype.createConfig = function() { url+="&"+that.vehicleParam; //url+="&locale=" + I18n.currentLocale(); //Doesn't actually work. MapQuest requires full locale e.g. "de_DE", but I18n only provides language, e.g. "de" url+="&manMaps=false"; - url+="&shapeFormat=raw&generalize=0"; - this.requestJSONP(url+"&callback="); + url+="&shapeFormat=raw&generalize=0&unit=k"; + this.requestCORS(url); }, gotRoute: function(router,data) { - // *** what if no route? + if (data.info.statuscode!=0) return false; var poly=[]; var shape=data.route.shape.shapePoints; @@ -69,7 +69,7 @@ MapQuestEngine.prototype.createConfig = function() { var d=(i==mq.length-1) ? 15: this.MQ_SPRITE_MAP[s.turnType]; steps.push([L.latLng(s.startPoint.lat, s.startPoint.lng), d, s.narrative, s.distance*1000]); } - router.setItinerary( { steps: steps }); + router.setItinerary( { steps: steps, distance: data.route.distance*1000, time: data.route['time'] }); return true; } };