-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathrouting.js
More file actions
31 lines (25 loc) · 871 Bytes
/
routing.js
File metadata and controls
31 lines (25 loc) · 871 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
27
28
29
30
31
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`+
`&customConsumptionDetails=40t`;
fetch(tollCostCall)
.then(response => response.json())
.then(response => {
console.log(response);
response.response.route.forEach(route=>{
document.getElementById("panel").innerHTML += `<br>`+ " Driver Cost: "+route.cost.details.driverCost+ " €"+
" Vehicle Cost: "+route.cost.details.vehicleCost+ " €"+
" Energy Cost: "+route.cost.details.energyCost+ " €"+
" Total Cost: "+route.cost.totalCost+" €";
});
}, error =>{
console.error(error);
});