- getRoute: function (points, callback) {
- return $.ajax({
- url: OSM.FOSSGIS_VALHALLA_URL,
- data: {
- json: JSON.stringify({
- locations: points.map(function (p) {
- return { lat: p.lat, lon: p.lng, radius: 5 };
- }),
- costing: costing,
- directions_options: {
- units: "km",
- language: I18n.currentLocale()
- }
- })
- },
- dataType: "json",
- success: function (data) {
- var trip = data.trip;
-
- if (trip.status === 0) {
- var line = [];
- var steps = [];
- var distance = 0;
- var time = 0;
-
- trip.legs.forEach(function (leg) {
- var legLine = L.PolylineUtil.decode(leg.shape, {
- precision: 6
- });
+ for (const leg of tripLegs) {
+ const legLine = L.PolylineUtil.decode(leg.shape, {
+ precision: 6
+ });