Calculate a route with charging along the way
For longer journeys with electric vehicles (EVs), it's important to plan for charging stops along the way as charging stations aren't as common as conventional refuelling stations.
HERE Routing API v8 can find routes for EVs that are optimized to get the best travel time including the required charging stops and ensure that the users reach their destination without running out of energy.
This isn't realized by enhancing a normal car route with stations along the way. The result of the calculation is a route optimized for electric vehicles.
This behavior can be enabled by adding ev[makeReachable]=true to the request.
Additional parameters related to the charging preferences and attributes of the vehicle are necessary.
The following route is only reachable after adding one charging station on the way. The result contains 2 sections.
The first section includes a postAction, which describes the charging stop.
It contains the information on the expected arrival charge, recommended target charge and speed of charging.
The consumption in the summary of the first section is negative, as the resulting charge is higher than at the start because of charging.
curl -gX GET 'https://router.hereapi.com/v8/routes?'\
'departureTime=any&'\
'origin=52.533959,13.404780&'\
'ev[connectorTypes]=iec62196Type2Combo&'\
'transportMode=car&'\
'destination=51.741505,14.352413&'\
'return=summary&'\
'ev[freeFlowSpeedTable]=10,0.130,20,0.132,30,0.136,40,0.142,50,0.151,60,0.161,70,0.176,80,0.194,90,0.214,100,0.237,110,0.264,120,0.290,130,0.321,140,0.354,150,0.389,160,0.426,170,0.466,180,0.509,190,0.554,200,0.601&'\
'ev[trafficSpeedTable]=0,0.349,27,0.319,45,0.329,60,0.266,75,0.287,90,0.318,100,0.33,110,0.335,120,0.35,130,0.36,250,0.36&'\
'ev[auxiliaryConsumption]=1.8&'\
'ev[ascent]=9&'\
'ev[descent]=4.3&'\
'ev[makeReachable]=true&'\
'ev[initialCharge]=48&'\
'ev[maxCharge]=80&'\
'ev[chargingCurve]=0,96,8,193,16,200,32,190,48,96,64,48,80,5&'\
'ev[maxChargeAfterChargingStation]=72&'\
'apiKey=YOUR_API_KEY'The departure block in the response now contains the start charge for that section and the arrival block contains the charge at the end of the section.
{
"routes": [
{
"id": "3931e21d-cd6f-4255-a3a2-bbd13904ec08",
"sections": [
{
"id": "063136a6-cc4a-4a0c-ba1d-8dbcd486552e",
"type": "vehicle",
"departure": {
"place": {
"type": "place",
"location": {
"lat": 52.5338755,
"lng": 13.4050137,
"elv": 92
},
"originalLocation": {
"lat": 52.5339589,
"lng": 13.4047799
}
},
"charge": 48
},
"arrival": {
"place": {
"type": "place",
"location": {
"lat": 51.7412356,
"lng": 14.3525337,
"elv": 115
},
"originalLocation": {
"lat": 51.741505,
"lng": 14.3524129
}
},
"charge": 1.7453
},
"summary": {
"duration": 5455,
"length": 132770,
"consumption": 46.2547,
"baseDuration": 5455
},
"transport": {
"mode": "car"
},
"consumptionType": "electric"
}
]
}
]
}Updated 9 days ago