Skip to main content
APIs 4 min read

Navigating Time-Aware Routes: Migrating from HERE Routing v7 to v8

time aware routing v8

In the previous post, we shared our journey migrating the EV Range Isoline Application from HERE Isoline Routing v7 to the latest v8. Building on that, this blog aims to provide valuable tips for migrating from HERE Routing v7 to the latest v8 in regards to time-aware routes and their pricing.

A Simple Route in HERE Routing v7

To calculate the direction between two locations, using the calculateroute service, it would require the following parameters

  • the authentication credentials,
  • the start (waypoint0) and destination (waypoint1) waypoints,
  • and the mode, which describes the type of route calculation and whether to take traffic into account.

This example requests the fastest route for a car without taking traffic conditions into account,

Copied
        https://route.ls.hereapi.com/routing/7.2/calculateroute.json
?apiKey={YOUR_API_KEY}
&waypoint0=geo!52.5,13.4
&waypoint1=geo!52.5,13.45
&mode=fastest;car;traffic:disabled
  

The above request without time-dependent restrictions would NOT be categorized as a Time Aware Routing for pricing purposes. 

A Time-Aware Route in HERE Routing v7

To calculate directions that take into account time-dependent restrictions, use the CalculateRouteRequest service specifying the start (waypoint0), the destination (waypoint1), and the departure time.

The following example requests the fastest route for a car in the presence of a restricted left turn at 3 pm.

Copied
        https://route.ls.hereapi.com/routing/7.2/calculateroute.json
?apiKey={YOUR_API_KEY}
&mode=fastest;car;
&waypoint0=geo!37.743385,-122.422835
&waypoint1=geo!37.743878,-122.423686
&departure=2014-03-12T10:00:00
  

The above request would be categorized as a Time Aware Routing for pricing purposes. 

A Basic (Time-Aware) Route in HERE Routing v8

A basic route request consists of an origin, departure, and transportMode, as shown in the following example below.

Copied
        https://router.hereapi.com/v8/routes
?transportMode=car
&origin=52.5308,13.3847
&destination=52.5323,13.3789
&return=summary
&apikey={YOUR_API_KEY}
  

The above request would be categorized as a Time Aware Routing for pricing purposes, since if the route request specifies neither the departureTime nor the arrivalTime parameter, then by default departure time (departureTime) for a route is the time of the route request. You can also use the departureTime or arrivalTime parameter to specify a time at which the route begins or ends respectively. 

The following example specifies the departureTime of 2021-09-03T08:30:25+02:00.

Copied
        https://router.hereapi.com/v8/routes
?transportMode=car
&origin=52.5308,13.3847
&destination=52.5323,13.3789
&return=summary
&departureTime=2021-09-03T08:30:25+02:00
&apikey={YOUR_API_KEY}'
  

A Planning Mode Route in HERE Routing v8

When the departure or arrival time of the route is not known in advance, you can set the departureTime=any or it is often referred to as "planning mode". If you specify departureTime as any, the route calculation will not take traffic flow and other time-dependent effects into account. Long-term closures (that is, current closures that last for more than a day) will still be considered. Note that sending the same request with the parameter departureTime=any at different times may result in different responses. 

The following example specifies departureTime as any

Copied
        https://router.hereapi.com/v8/routes
?transportMode=car
&origin=52.5308,13.3847
&destination=52.5323,13.3789
&return=summary
&departureTime=any
&apikey={YOUR_API_KEY}
  

The above request would NOT be categorized as a Time Aware Routing for pricing purposes. 

Closing Thought

In HERE Routing v8, by default, departure time (departureTime) for a route is the time of the route request (now), hence the request would be categorized as a Time Aware Routing for pricing purposes. When the departure or arrival time of the route is not known in advance, you can set the departureTime=any or it is often referred to as "planning mode". Please refer to the pricing page for more information. 

Resources

Erwin Soekianto

Erwin Soekianto

Developer Evangelist

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