Route summary
A section summary provides total values for a route section, such as its length, duration, consumption, and toll cost. For the full list of attributes available in a section summary, see the API Reference.
To request a section summary, add summary, travelSummary, or both to the return parameter:
summarycovers the entire section, including any pre-actions and post-actions.travelSummarycovers only the travel portion of the section; it excludes pre-actions and post-actions.
Section summary format
Both summary and travelSummary can contain the following attributes:
| Attribute | Description |
|---|---|
duration | Total duration of the section, in seconds. |
baseDuration | Duration of the section without time-aware information, in seconds. Not returned for ferry sections, whose duration value doesn't change based on time-aware information. |
typicalDuration | Duration of the section under typical traffic conditions, in seconds. Requires return=typicalDuration. |
length | Total length of the section, in meters. |
The following example request returns both summary and travelSummary for each section. The response shows how the two differ because of the wait post-action at the end of the first section.
curl -gX GET 'https://router.hereapi.com/v8/routes?'\
'origin=52.51375,13.42462&'\
'destination=52.52332,13.42800&'\
'via=52.52426,13.43000!stopDuration=120&'\
'return=polyline,summary,travelSummary&'\
'transportMode=car&'\
'apiKey=YOUR_API_KEY'{
"routes": [
{
"id": "ceab8139-1857-48d3-9f04-40e1c993c8e1",
"sections": [
{
"id": "3542b673-a1ae-4363-81cf-8326e6b10307",
...,
"postActions": [
{
"action": "wait",
"duration": 120
}
],
...,
"summary": {
"duration": 294,
"length": 1281,
"baseDuration": 256
},
"travelSummary": {
"duration": 174,
"length": 1281,
"baseDuration": 136
},
"polyline": "...",
"transport": {
"mode": "car"
}
},
{
"id": "43d61f69-5591-4dd6-81e1-ca4c76c91c27",
...
}
]
}
]
}Get the total route duration and length
HERE Routing API v8 doesn't return a summary for the entire calculate route, only for its individual sections.
- To get the total duration of a route, sum the
duration(orbaseDuration,typicalDuration) values from every section. - To get the total length of a route, sum the
lengthvalues from every section.
Calculate duration for routes with ferry transit
Ferry sections don't have baseDuration because their duration isn't affected by traffic data.
The following request returns the data needed to calculate route duration both with and without traffic. When summing section durations for a route with a ferry, use the ferry section's duration in the calculation (since it has no traffic-adjusted variant).
curl -gX GET 'https://router.hereapi.com/v8/routes?'\
'origin=51.13747,1.33148&'\
'destination=50.96035,1.905025&'\
'return=summary&'\
'transportMode=car&'\
'apiKey=YOUR_API_KEY'{
"routes": [
{
"id": "fe1d3ac8-411e-4b47-bd2a-8056484865ce",
"sections": [
{
"id": "3f104c2d-7ec2-4a63-9e3b-dcf6b9acd251",
"type": "vehicle",
...,
"summary": {
"duration": 541,
"length": 3898,
"baseDuration": 501
},
"transport": {
"mode": "car"
}
},
{
"id": "2239e39b-4eef-4ce0-9988-1c434a1e13a9",
"type": "transit",
...,
"summary": {
"duration": 5449,
"length": 40565
},
...,
"transport": {
"mode": "ferry",
"name": "Dover-Calais"
}
},
{
"id": "554714bc-a8c1-406f-8895-d2f81f88722e",
"type": "vehicle",
...,
"summary": {
"duration": 440,
"length": 5273,
"baseDuration": 396
},
"transport": {
"mode": "car"
}
}
]
}
]
}Total duration (freeflow, no traffic) =
first section `baseDuration`
+ second (ferry) section `duration`
+ third section `baseDuration`
= 501s + 5449s + 396s
= 6346s
= 1h45m46sTotal duration (with traffic) =
first section `duration`
+ second (ferry) section `duration`
+ third section `duration`
= 541s + 5449s + 440s
= 6430s
= 1h47m10sRelated content
Updated 26 days ago