Results 1 to 8 of 8

Thread: Avoid Toll Road setting doesn't work.

  1. #1
    Neuer skobbler
    Join Date
    27.07.2016
    Posts
    9

    Avoid Toll Road setting doesn't work.

    The avoid toll roads setting is not working.
    I have verified through debugging that I correctly call "restrictions.setTollRoadsAvoided(true)", but the route I have given is still taking the toll road.

    Here is an examlple of to points that can be connected via toll roads or without.

    from: 8101 Aircenter Court, Orlando, FL 32809
    to: 1 Jeff Fuqua Boulevard, Orlando, FL 32827

    here are the routes with and without toll roads according to google.

    with toll roads:
    Screen Shot 2016-09-23 at 1.55.33 PM.jpg

    without toll roads:
    Screen Shot 2016-09-23 at 1.55.52 PM.jpg

    With Skobbler I get the route that takes to toll road not matter what I set as the setting.

    This is not the only case, this issue was reported to me by others.

  2. #2
    Dev platform evangelist dandronic's Avatar
    Join Date
    31.03.2014
    Posts
    177
    What version of the SDK are you using?
    On 3.0.0 and 3.0.1 the maps contain the correct toll date -> the generated route is correct:Simulator Screen Shot 27 Sep 2016 16.33.40.jpg (I'm using a normal car route with avoidTolls YES)

  3. #3
    Neuer skobbler
    Join Date
    27.07.2016
    Posts
    9
    I have the latest SDK which was sent to us (about 3-4 weeks ago), but I actually haven't been able to find a place in your library where the actual version number is recorded. I've been installing from folder that Adella sends us and that doesnt have the version numner in the name. It's just called "AndroidOpenSourceDemoTraffic".

    This is the full code blobk I use to initiate the route:

    ( I've tried in BOTH Efficient and Fastest modes, and I've verified the value being passed to "restrictions.setTollRoadsAvoided", is "true")

    SKRouteSettings route = new SKRouteSettings();
    route.setStartCoordinate(start);
    route.setDestinationCoordinate(end);
    route.setMaximumReturnedRoutes(1);

    switch (MainActivity.CurrentSettings.modeOfTravel) {
    case MODE_OF_TRAVEL_CAR:
    if (currentRouteSettingsAlternateRouting) {
    route.setRouteMode(SKRouteSettings.SKRouteMode.CAR _FASTEST);
    } else {
    route.setRouteMode(SKRouteSettings.SKRouteMode.EFF ICIENT);
    }
    break;
    case MODE_OF_TRAVEL_BICYCLE:
    route.setRouteMode(SKRouteSettings.SKRouteMode.BIC YCLE_FASTEST);
    break;
    case MODE_OF_TRAVEL_FOOT:
    route.setRouteMode(SKRouteSettings.SKRouteMode.PED ESTRIAN);
    break;
    }

    // Traffic enabled
    route.setUseLiveTraffic(true);
    route.setUseLiveTrafficETA(true);

    SKRouteRestrictions restrictions = new SKRouteRestrictions();
    restrictions.setTollRoadsAvoided(currentRouteSetti ngsAvoidToll);
    restrictions.setHighWaysAvoided(currentRouteSettin gsAvoidHighways);
    restrictions.setFerriesAvoided(currentRouteSetting sAvoidFerries);

    if (currentRouteSettingsMute) {
    SKToolsAdvicePlayer.getInstance().enableMute();
    } else {
    SKToolsAdvicePlayer.getInstance().disableMute();
    }

    if (destManager.getNumDests() > 1) {
    ArrayList viaPoints = new ArrayList();

    for (int i = 0; i < destManager.getNumDests() - 1; i++) {
    DestinationManager.DestinationViewHolder dest = destManager.getDestByIndex(i);
    viaPoints.add(new SKViaPoint(dest.destId, dest.destinationObject.getSKCordinants()));
    }
    route.setViaPoints(viaPoints);

    }


    route.setRouteExposed(true);

    SKRouteManager.getInstance().setTrafficRoutingMode (SKMapSettings.SKTrafficMode.FLOW_AND_INCIDENTS);
    SKRouteManager.getInstance().setRouteListener(this );
    SKRouteManager.getInstance().calculateRoute(route) ;

  4. #4
    Dev platform evangelist dandronic's Avatar
    Join Date
    31.03.2014
    Posts
    177
    In the demo project (3.0.1), with the traffic API enabled, I modified the launchRouteCalculation method to reflect your settings:
    Code:
      private void launchRouteCalculation(SKCoordinate startPoint, SKCoordinate destinationPoint) {
            clearRouteFromCache();
            // get a route object and populate it with the desired properties
            SKRouteSettings route = new SKRouteSettings();
            // set start and destination points
            route.setStartCoordinate(startPoint);
            route.setDestinationCoordinate(destinationPoint);
            // set the number of routes to be calculated
            route.setMaximumReturnedRoutes(1);
            // set the route mode
            route.setRouteMode(SKRouteMode.CAR_FASTEST);
            route.setUseLiveTraffic(true);
            route.setUseLiveTrafficETA(true);
    
            SKRouteRestrictions restrictions = new SKRouteRestrictions();
            restrictions.setTollRoadsAvoided(true);
            restrictions.setHighWaysAvoided(false);
            restrictions.setFerriesAvoided(false);
            route.setRouteRestrictions(restrictions);
    
            SKRouteManager.getInstance().setTrafficRoutingMode(SKMapSettings.SKTrafficMode.FLOW_AND_INCIDENTS);
    
            // set whether the route should be shown on the map after it's computed
            route.setRouteExposed(true);
            // set the route listener to be notified of route calculation
            // events
            SKRouteManager.getInstance().setRouteListener(this);
            // pass the route to the calculation routine
            SKRouteManager.getInstance().calculateRoute(route);
        }
    using
    Code:
    launchRouteCalculation(new SKCoordinate(28.426912,-81.3065897), new SKCoordinate(28.450522, -81.356446));
    The generated route correctly avoids toll roads route without toll roads.jpg

  5. #5
    Neuer skobbler
    Join Date
    27.07.2016
    Posts
    9
    Can you send me a link to download the exact version of the SDK you are using please? you can send it to my email if it needs to be private siavashcj@gmail.com

  6. #6
    Dev platform evangelist dandronic's Avatar
    Join Date
    31.03.2014
    Posts
    177
    I've sent you my modified demo project via email.

  7. #7
    Neuer skobbler
    Join Date
    27.07.2016
    Posts
    9
    I found the problem.
    If you look at the code I posted, you will see that after creating the route restrictions, I wasn't actually passing it to the RouteSettings object by calling route.setRouteRestrictions(restrictions);

  8. #8
    Dev platform evangelist dandronic's Avatar
    Join Date
    31.03.2014
    Posts
    177
    Ok - I had not noticed that either - I'm glad to hear that the problem is now solved.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •