Skip to main content
APIs 5 min read

Understanding HERE EV Routing API response

route section diagram

Last week we released an EV Routing sample showing how to add via waypoints to the HERE Routing API using HERE Maps API for Javascript. In that blog, we showed how to add the "via" parameter in the API request. This week, we are going to discuss in detail the response that we get from HERE Routing API with the EV Routing feature ('ev[makeReachable]':'true'). This blog is meant to be used as an additional resource to the documentation page.  

We are going to use the response from the API request of that sample, showing the EV routes in Thailand with multiple via waypoints, see below. The route response may include various notices that indicate errors or warnings about the route calculation. The routes array contains the result route that is divided into one or more sections. 

Copied
        {
    "notices": [
      // More notices...
    ],
    "routes": [
        {
            "id": "0f90509d-915e-414e-85ae-331bbeb72c15",
            "sections": [
                {
                    "id": "8f91fa66-6e7e-4654-bee5-bc37d95e2a68",
                    // Via waypoint stop section. More attributes...
                },
                {
                     "id": "71926344-236b-47cc-afc1-e8f86d5b969d",
                     // Charging stop section. More attributes...
                },
                // More sections....
             ]
        }
     ]
}
  

Each section represents the part of the route between two consecutive waypoints or charging stops for this scenario. Below is the sample section from the origin in Chiang Rai to the first via waypoint stop in Chiang Mai, Thailand. The section for via waypoint stop includes the following attributes: 

  • id, type, language, and transport attributes are fairly self-explanatory. 
  • actions and turnByTurnActions attributes contain a series of actions that specify what needs to be done at or during a specific portion of the route, for example, turn right, as shown below. 
  • departure and arrival attributes contain the location of the departure and arrival of the section, and in this scenario, it includes the charge level at those locations. 
  • travelSummary attribute provides summary information for only the travel portion of the section, and in this scenario, it includes the battery consumption for the section.  
  • polyline attribute contains the geometry for the portion of the section in flexible polyline encoding format. 
Copied
        {
    "id": "2fb62246-e3a8-425c-914e-05d77d41e1f2",
    "sections": [
        {
            //Via waypoint stop section
            "id": "a1f0a884-9082-41e5-8023-6fd0386f0fbd",
            "type": "vehicle",
            "actions": [
                {
                        "action": "turn",
                        "duration": 8339,
                        "length": 158697,
                        "instruction": "Turn right onto 118 toward Mae Suai/Chiang Mai. Go for 159 km.",
                        "offset": 405,
                        "direction": "right",
                         "severity": "quite"
                 },
                //more actions...
            ],
            "turnByTurnActions": [
                // more turnByTurnActions
            ],
            "departure": {
                "time": "2022-10-26T05:52:28+07:00",
                "place": {
                    "type": "place",
                    "location": { // Chiang Rai, Thailand (Origin)
                        "lat": 19.91051,
                        "lng": 99.84061,
                        "elv": 358
                    }
                },
                "charge": 99
            },
            "arrival": {
                "time": "2022-10-26T08:47:36+07:00",
                "place": {
                    "type": "place",
                    "location": { //Chiang Mai, Thailand (first via waypoint stop)
                        "lat": 18.7959553,
                        "lng": 98.9792572,
                        "elv": 282
                    },
                    "waypoint": 0
                },
                "charge": 34.2907
            },
            "travelSummary": {
                "duration": 10508,
                "length": 189183,
                "consumption": 64.7093,
                "baseDuration": 10022
            },
            "polyline": "<<<encoded polyline>>>",
            "language": "en-us",
            "transport": {
                "mode": "car"
            }
        },
        {
            "id": "71926344-236b-47cc-afc1-e8f86d5b969d",
           // Charging stop section. More attributes...
        },
        // More sections....
        
    ]
}
  

And below is the sample section from one of the via waypoint stops to a charging stop, which includes the following additional attributes or information:

  • id, type, actions, turnByTurnActions, travelSummary, polyline, language, and transport are the same as the above explanation for a waypoint stop. 
  • postActions attribute describes actions that are performed after the arrival of a section, and in this scenario, it describes a charging stop. It contains information on the expected arrival charge, recommended target charge, and charging time.
  • departure and arrival attributes when they are at a charging stop, include additional attributes of the charging stop such as brand, connector type, power, current, voltage and supply type. 
Copied
        {
    "id": "2fb62246-e3a8-425c-914e-05d77d41e1f2",
    "sections": [
        {
            "id": "a1f0a884-9082-41e5-8023-6fd0386f0fbd",
             //Via waypoints stop section. More attributes...
        },
        {
            //Charging stop section
            "id": "71926344-236b-47cc-afc1-e8f86d5b969d",
            "type": "vehicle",
            "actions": [
               // More actions...
            ],
            "turnByTurnActions": [
               // More turnByTurnActions...
            ],
            "postActions": [
                {
                    "action": "chargingSetup",
                    "duration": 300
                },
                {
                    "action": "charging",
                    "duration": 432,
                    "consumablePower": 120,
                    "arrivalCharge": 32.3298,
                    "targetCharge": 45.3
                }
            ],
            "departure": {
                  // Same as a waypoint stop section for this scenario
            },
            "arrival": {
                "time": "2022-10-26T08:55:14+07:00",
                "place": {
                    "type": "chargingStation",
                    "location": {
                        "lat": 18.767966,
                        "lng": 98.98347,
                        "elv": 267
                    },
                    "id": "ZGY6NDNjZjAzYzNlYmMzMDg4OWJkMzkzMWE4MmUwYmQ2NzM",
                    "attributes": {
                        "power": 120,
                        "current": 250,
                        "voltage": 500,
                        "supplyType": "dc",
                        "connectorType": "iec62196Type2Combo"
                    },
                    "brand": {
                        "hrn": "d41d8cd98f00b204e9800998ecf8427e"
                    }
                },
                "charge": 32.3298
            },
            "travelSummary": {
                 // Same as a waypoint stop section
            },
            "polyline": "<<<encoded polyline>>>",
            "language": "en-us",
            "transport": {
                "mode": "car"
            }
        },
        // More sections....
        
    ]
}
  

EV Routing is a powerful feature in the HERE Routing API, and working with a large API response can be an overwhelming task. We hope you find this blog post going in-depth about the API response fo the HERE Routing API with EV Routing feature. Feel free to leave a comment or reach us on Twitter at @heredev, we are excited to see what you are building with the HERE platform! 

 

Erwin Soekianto

Erwin Soekianto

Have your say

Sign up for our newsletter

Why sign up:

  • Latest offers and discounts
  • Tailored content delivered weekly
  • Exclusive events
  • One click to unsubscribe