'Optimizing waypoints and getting the route

Context

The service I'm building needs to performs two steps using the HERE API.

  1. It needs to calculate the optional route between multiple waypoints. This can be achieved using the Waypoint Sequencing API.
  2. It also needs to display the route on a map, so I need polylines for the route. This can be retrieved using the Routing API.

The problem

According to the docs:

The Fleet Telematics Waypoints Sequence does not include route details in its responses. To request a route, use the HERE Routing API.

That is, the use of the two distinct services cannot be avoided. However, there seem to be major differences between the services. For example, when calculating the optimal route, you may restrict certain road types, such as tollroad or motorway, to a degree. On the other hand, Routing API, I can only avoid certain types, and it's an either-or choice.

Here's (no pun intended) an example: let's say the user wants to avoid toll roads unless absolutely necessary, thus he sets tollroad to -3 in the Waypoint Sequencing API. When the actual route is calculated, we only have the choice to allow toll roads, meaning, potentially every part of the route will go through such roads, or disallow them entirely.

The question itself

Is there any way I'm missing to "mediate" between the results of the two services? Essentially, I would like to display the route the Waypoint Sequencing API found to be ideal for all the provided options.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source