// GraphHopper Directions API documentation
// https://github.com/graphhopper/directions-api/blob/master/docs-routing.md
return $.ajax({
- url: document.location.protocol + "//graphhopper.com/api/1/route",
+ url: document.location.protocol + OSM.GRAPHHOPPER_URL,
data: {
vehicle: vehicleType,
locale: I18n.currentLocale(),
type: "jsonp",
elevation: false,
instructions: true,
- point: points.map(function (p) { return p.lat + "," + p.lng })
+ point: points.map(function (p) { return p.lat + "," + p.lng; })
},
traditional: true,
dataType: "jsonp",
]); // TODO does graphhopper map instructions onto line indices?
}
- callback(null, {
+ callback(false, {
line: line,
steps: steps,
distance: path.distance,
time: path.time / 1000
});
+ },
+ error: function () {
+ callback(true);
}
});
}