Routing API Developer's Guide

Calculate Route

Use the calculateroute resource to return a route between two waypoints. The required parameters for this resource are app_id and app_code, two or more waypoints (waypoint0 and waypoint1, to waypointN) and mode (specifying how to calculate the route, and for what mode of transport). For some modes departure (if applicable) is required. This includes all modes with enabled traffic. Other parameters can be left unspecified.

../routing/7.2/calculateroute.{format}?<parameter>=<value>... 
Parameter Description
app_id

A 20 bytes Base64 URL-safe encoded string used for the authentication of the client application.

You must include an app_id with every request. To get an app_id assigned to you, please see Acquiring Credentials.

app_code

A 20 bytes Base64 URL-safe encoded string used for the authentication of the client application.

You must include an app_code with every request. To get an app_code assigned to you, please see Acquiring Credentials.

waypoint List of waypoints that define a route. The first element marks the startpoint, the last the endpoint. Waypoints in between are interpreted as via points.

See also WaypointParameterType

waypoint0=geo!52.5,13.4
mode

The routing mode determines how the route is calculated.

See also RoutingModeType

Type;TransportModes;TrafficMode;Feature

&mode=fastest;car;traffic:disabled;motorway:-2
requestId Clients may pass in an arbitrary string to trace request processing through the system. The RequestId is mirrored in the MetaInfo element of the response structure.
avoidAreas Areas which the route must not cross. Array of up to 20 BoundingBox-es. Example with two bounding boxes:
avoidareas=52.517100760,
13.3905424488;
52.5169701849,
13.391808451!
52.517000760,
13.3700424488;
52.5168701849,
13.371308451
avoidLinks Links which the route must not cross. The list of LinkIdTypes. LinkIdType is a xs:string with the following regular expression restrictions: [*-+]\d+
avoidlinks=-53623477
avoidSeasonalClosures The optional avoid seasonal closures boolean flag can be specified to avoid usage of seasonally closed links:
avoidseasonalclosures=true

Examples of seasonally closed links are roads that may be closed during the winter due to weather conditions or ferries that may be out of operation for the season (based on past closure dates).

allowedZones

Identifiers of zones where routing engine should not take zone restrictions into account (for example in case of a special permission to access a restricted environmental zone). Allowed zones are also not considered in evaluation of the excludezonetypes parameter. Type: list of xs:unsignedLong.

To obtain identifiers of relevant zones use the getroutingzones resource.

licenseplate=lastcharacter:5&allowedzones=167772378 // ignore license plate rules in Indonesia Odd/Even scheme zones
excludezonetypes=vignette&allowedzones=508 // disable all roads where any vignette applies except vignette in Austria
excludeZones Identifiers of zones which the route must not cross under any circumstances. Type: list of xs:unsignedLong.

To obtain identifiers of relevant zones use the getroutingzones resource.

excludezones=510,511
excludeZoneTypes List of zone types which the route must not cross under any circumstances. See RoutingZoneTypeType for supported zone types.
excludezonetypes=vignette,congestionPricing
excludeCountries Countries that must be excluded from route calculation. Type: list of common:CountryCodeType.
excludecountries=AUT,CHE
departure Time when travel is expected to start. Traffic speed and incidents are taken into account when calculating the route (note that in case of a past departure time the historical traffic is limited to one year). You can use now to specify the current time. Type: xs:dateTime.
departure=2018-07-04T17:00:00+02
When the optional timezone offset is not specified time is assumed to be local.
alternatives Maximum number of alternative routes that will be calculated and returned. Alternative routes can be unavailable, thus they are not guaranteed to be returned. If at least one via point is used in a route request, returning alternative routes is not supported. 0 stands for "no alternative routes", i.e. only best route is returned. Type: xs:integer.
alternatives=3
metricSystem Defines the measurement system used in instruction text. When imperial is selected, units used are based on the language specified in the request. Defaults to metric when not specified. xs:string. Enum [imperial | metric]
viewBounds

If the view bounds are given in the request then only route shape points which fit into these bounds will be returned. The route shape beyond the view bounds is reduced to the points which are referenced by links, legs or maneuvers. A common use case for this is the drag and drop scenario where the client is only interested in a rough visual update of the route in the currently visible bounds. See also BoundingBox.

viewbounds=37.7902858,-122.4027371;
37.7890649,-122.3993039
resolution

Specifies the resolution of the view and a possible snap resolution in meters per pixel in the response. You must specify a whole, positive integer.

If you specify only one value, then this value defines the view resolution only.

You can use snap resolution to adjust waypoint links to the resolution of the client display.

resolution=viewresolution:snapresolution
resolution=300:300
instructionFormat Defines the representation format of the maneuver's instruction text. InstructionFormatType instructionformat=Enum [ text | html]
language

A list of languages for all textual information, the first supported language is used. If there are no matching supported languages the response is an error. Defaults to en-us. See Languages for a list of supported languages.

jsonAttributes Flag to control JSON output. Combine parameters by adding their values. See also JSON Representation.
jsonattributes=9
jsonCallback

Name of a user-defined function used to wrap the JSON response.

representation

Define which elements are included in the response as part of the data representation of the route. See also RouteRepresentationModeType.

Enum [ overview | display | dragNDrop | navigation | linkPaging | turnByTurn ]

routeAttributes

Define which attributes are included in the response as part of the data representation of the route. Defaults to waypoints, summary, legs See also RouteAttributeType.

Enum [ waypoints | summary | summaryByCountry | shape | boundingBox | legs | notes ]

legAttributes

Define which attributes are included in the response as part of the data representation of the route legs. Defaults to maneuvers, waypoint, length, travelTime. See also RouteLegAttributeType.

Enum [ waypoint | maneuvers | links | length | travelTime | shape | indices | boundingBox | baseTime | trafficTime | summary ]

maneuverAttributes

Define which attributes are included in the response as part of the data representation of the route maneuvers. Defaults to position, length, travelTime. See also ManeuverAttributeType

Enum [ position | shape | travelTime | length | time | link | roadName | nextRoadName | roadNumber | nextRoadNumber | signPost | notes | action | direction | freewayExit | freewayJunction | indices | baseTime | trafficTime | boundingBox | roadShield | shapeQuality | nextManeuver | startAngle ]

linkAttributes

Define which attributes are included in the response as part of the data representation of the route links. Defaults to shape, speedLimit, . See also RouteLinkAttributeType.

Enum [ consumption | dynamicSpeedInfo | flags | functionalClass | indices | length | maneuver | nextLink | remainDistance | remainTime | roadName | roadNumber | shape | speedLimit | timeDependentRestriction | timezone ]

generalizationTolerances Specifies the desired tolerances for generalizations of the base route geometry. Tolerances are given in degrees of longitude or latitude on a spherical approximation of the Earth. One meter is approximately equal to 0:00001 degrees at typical latitudes. Type: xs:list of xs:double.
generalizationtolerances=0.1,0.01
vehicleType

Specifies type of vehicle engine and average fuel consumption, which can be used to estimate CO2 emission for the route summary (RouteSummaryType).

See also VehicleType

vehicletype=diesel,5.5
walkSpeed Specifies speed which will be used by a service as a walking speed for pedestrian routing (meters per second). The provided value must be between 0.5 and 2. Type:SpeedType.
walkSpeed=1.25
returnElevation

If set to true, all shapes inside routing response will consist of 3 values instead of 2. Third value will be elevation. If there are no elevation data available for given shape point, elevation will be interpolated from surrounding points. In case there is no elevation data available for any of the shape points, elevation will be 0.0. If jsonattributes=32, elevation cannot be returned.

returnelevation=true

Example Request

https://route.hereapi.cn/routing/7.2/calculateroute.xml
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&waypoint0=geo!52.5,13.4
&waypoint1=geo!52.5,13.45
&mode=fastest;car;traffic:disabled

Example Request for SummaryByCountry

https://route.hereapi.cn/routing/7.2/calculateroute.xml
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&waypoint0=geo!50.8857,14.81589
&waypoint1=geo!50.8681536,14.8308207
&routeattributes=wp,sm,sh,sc
&mode=fastest;car

Example Response for SummaryByCountry


<Route>

 . . . 

  <Summary>
    <Distance>2218</Distance>
    <TrafficTime>109</TrafficTime>
    <BaseTime>109</BaseTime>
    <Flags>motorway</Flags>
    <TravelTime>109</TravelTime>
  </Summary>

  <SummaryByCountry>
    <Distance>297</Distance>
    <TrafficTime>21</TrafficTime>
    <BaseTime>21</BaseTime>
    <Flags>motorway</Flags>
    <TravelTime>21</TravelTime>
    <Country>DEU</Country>
  </SummaryByCountry>
  <SummaryByCountry>
    <Distance>1471</Distance>
    <TrafficTime>58</TrafficTime>
    <BaseTime>58</BaseTime>
    <Flags>motorway</Flags>
    <TravelTime>58</TravelTime>
    <Country>POL</Country>
  </SummaryByCountry>
  <SummaryByCountry>
    <Distance>450</Distance>
    <TrafficTime>30</TrafficTime>
    <BaseTime>30</BaseTime>
    <Flags>motorway</Flags>
    <TravelTime>30</TravelTime>
    <Country>CZE</Country>
  </SummaryByCountry>
</Route>