So to be clear, I mainly use the API (Directions and Optimization) but I find it easier to visualize the issue by using your web client here. I am curious as to why a recommended HGV route has a longer distance AND takes more time than if I check “avoid motorways”:
You can see in the link that this route is 200.4 kilometers long and takes 3:42h. If I check “avoid motorways” the suggested route is just 127.3 kilometers long AND takes just 3:03h. So it seems to be superior in every way to me. Hence, why is it not the recommended route? What is the goal in the optimization strategy here?
I also run into the same issue using the optimization API (which internally uses the Vroom API as your site states, so it would probably be a different graph). But here, too, the HGV is routed over that far longer distance on the motorway which is problematic. Is there a way to, let’s say, optimize for distance?
Indeed, the observed behavior might be counterintuitive. When computing the recommended route primarily travel time is taken into account. However, the actual cost function in the route optimizing problem is further modified based on suitability of the given road segments for an hgv vehicle. In the example you provided the shorter and reportedly faster route also seems to be more windy, therefore it’s probably less well suited for a large truck.
You can optimize for distance by switching the route preference from recommended to shortest.
Thanks @jschnell for chiming in and pointing to the issue!
Please note that the currently reported travel times for hgv vehicles might be a bit exaggerated, especially for long distance routes involving motorways. A fix is on the way, so stay tuned