0

When trying to calculate this route, I'm getting a VIOLATES_OPTIONS error with violations: [BLOCKED_ROADS].

Premium Android SDK 3.17

Route options:

val routeOptions = RouteOptions().apply {
    transportMode = RouteOptions.TransportMode.TRUCK
    truckHeight = vehicle.height
    truckLength = vehicle.length
    truckWidth = vehicle.width
    truckWeightPerAxle = 10.0f
    truckAxleCount = 2
    truckTunnelCategory = RouteOptions.TunnelCategory.UNDEFINED
    speedProfile = RouteOptions.SpeedProfile.FAST
    routeType = RouteOptions.Type.FASTEST
}

Dynamic penalties:

val dynamicPenalty = DynamicPenalty().apply {
    trafficPenaltyMode = Route.TrafficPenaltyMode.OPTIMAL
}

coreRouter.setDynamicPenalty(dynamicPenalty)

I already figured out by tweaking some of the parameters that the problem seems to be related to the vehicle length (which can vary depending on the vehicle), however there are still some questions:

  • Is there any way to figure out what the problem is (programatically) or get a more precise reason? Documentation says "The route uses roads which were blocked by dynamic penalties.", but what penalty exactly? Also it seems to be related to vehicle length and not one of the dynamic pentalties (error also occurs without any of those being set or when setting traffic penalty to DISABLED). We have a lot of users and investigating these errors by hand every time this error occurs is not very feasible.

  • Is there a way / plans to include the coordinates for where the violation took place? This would be incredibly useful IMO. I can't think of a workaround / handling this error, because I don't know the exact location where the issue originates and thus cannot evebn figure out the root cause / blacklist some area if we wanted to manually fix it.

  • And my last and most important question: What can I do to get an alternative route (that avoids the problematic / violating area)?

gnj
  • 138
  • 1
  • 8
  • Please provide the values for vehicle.height, vehicle.length and vehicle.width –  Jul 21 '21 at 08:56
  • height: 4m, length: 14m, width: 2,55m – gnj Jul 22 '21 at 16:08
  • We are investigating the root cause of this issue thank you for your patience. We would like you to recommend using following method - public RouteOptions setRouteCount(int count) Sets the desired number of route. The default is 1. Values greater than 10 are ignored if RouteOptions.TransportMode is set to public transport and online timetables are enabled. Only one route will be returned for routes with more than two RouteWaypoint. Parameters: count - route count Returns: The modified RouteOptions itself. –  Aug 02 '21 at 14:10
  • Hey, unfortunately this doesn't solve the issue for us, as there is only a single route result, even when setting a routeCount option greater than one. – gnj Aug 23 '21 at 14:24
  • Any other suggestions? – gnj Aug 23 '21 at 14:30

1 Answers1

0

From further Investigation we found the following points. It's expected behavior, you can check the below request by providing the API key.

https://router.hereapi.com/v8/routes?origin=42.695,2.87907&transportMode=truck&destination=41.3947,2.18237&truck[length]=1400&return=polyline,actions,instructions,summary&apikey={YOUR-API-KEY}

It's happened because Barcelona has time restrictions on truck length. To handle this case, you can write:

public void onCalculateRouteFinished(List<RouteResult> routeResults,RoutingError routingError)
{if (routingError == RoutingError.NONE || routingError == RoutingError.VIOLATES_OPTIONS) // added for violated options
    {
    m_route = routeResults.get(0).getRoute();
    // continued work this route
    .....
    if( routingError.toString() != "" )
    { 
    Toast.makeText(m_activity, "Route calculation returned with code " + routingError.toString() );
    }
    }
}