-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathrouting.js
More file actions
26 lines (20 loc) · 743 Bytes
/
routing.js
File metadata and controls
26 lines (20 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var tollCostCall = `https://fleet.ls.hereapi.com/2/calculateroute.json`+
`?apiKey=${window.hereCreds.JS_KEY}`+
`&waypoint0=52.53086235,13.38475371`+
`&waypoint1=53.13256,17.98909`+
`&mode=fastest;truck;traffic:enabled`+
`&alternatives=3`+
`&legAttributes=none`+
`&routeAttributes=none`+
`&driver_cost=10`+
`&vehicle_cost=0.5`+
`¤cy=EUR`;
fetch(tollCostCall)
.then(response => response.json())
.then(response => {
response.response.route.forEach(route=>{
document.getElementById("panel").innerHTML += `<br>`+ " Driver Cost: "+route.cost.details.driverCost+ " €"+" Vehicle Cost: "+route.cost.details.vehicleCost+ " €"+" Total Cost: "+route.cost.totalCost+" €";
});
}, error =>{
console.error(error);
});