Sorry, you need to enable JavaScript to visit this website.

Route avoids

Route avoids

Allow your users to plan a route that avoids toll roads, motorways, ferries, unpaved roads, carpool lanes, roads that they have already taken, vignettes, or even whole areas.

Sample use case: You plan a trip between the TomTom offices in Amsterdam and Oslo. You would like to check how much time you gain by taking a ferry and how much more time it will take to drive if you don’t use motorways so you can choose the best route.

Available routes to avoid:

routeAvoid = Avoid.TOLL_ROADS
routeAvoid = Avoid.MOTORWAYS
routeAvoid = Avoid.FERRIES
routeAvoid = Avoid.UNPAVED_ROADS
routeAvoid = Avoid.CAR_POOLS
routeAvoid = Avoid.ALREADY_USED_ROADS

To request a route for a specified route avoid:

_

RouteQuery queryBuilder = RouteQueryBuilder.create(routeConfig.getOrigin(), routeConfig.getDestination())
        .withMaxAlternatives(0)
        .withReport(Report.NONE)
        .withInstructionsType(InstructionsType.NONE)
        .withAvoidType(routeAvoid)
        .withConsiderTraffic(false).build();
val routeQuery = RouteQueryBuilder.create(origin, destination)
        .withMaxAlternatives(MAX_ALTERNATIVES)
        .withReport(Report.NONE)
        .withInstructionsType(InstructionsType.NONE)
        .withAvoidType(avoidType)
        .withConsiderTraffic(false)
        .build()

 

image

Route avoid ferries

image

Route avoid motorways

image

Route avoid toll roads

Sample use case: You plan a trip from A to B and you know that on your way there are vignettes. Additionally, there is an area which has very high traffic. You want to avoid both vignettes and the specified area.

To avoid vignettes:

_

List<String> avoidVignettesList = new ArrayList<>();
avoidVignettesList.add("HUN");
avoidVignettesList.add("CZE");
avoidVignettesList.add("SVK");

RouteQuery routeQuery = RouteQueryFactory.createRouteForAvoidsVignettesAndAreas(avoidVignettesList, routeConfig);
    val listOfVignettes = listOf("HUN", "CZE", "SVK")
val routeQuery = RouteQueryBuilder.create(routeConfig.origin, routeConfig.destination)
        .withMaxAlternatives(MAX_ALTERNATIVES)
        .withReport(Report.NONE)
        .withInstructionsType(InstructionsType.NONE)
        .withConsiderTraffic(false)
        .withAvoidVignettes(avoidVignettesList)
        .build()

To avoid an area:

_

BoundingBox boundingBox = new BoundingBox(ARAD_TOP_LEFT_NEIGHBORHOOD, ARAD_BOTTOM_RIGHT_NEIGHBORHOOD);

RouteQuery routeQuery = RouteQueryFactory.createRouteForAvoidsArea(boundingBox, routeConfig);
    val boundingBox = BoundingBox(Locations.ARAD_TOP_LEFT_NEIGHBORHOOD, Locations.ARAD_BOTTOM_RIGHT_NEIGHBORHOOD)
val routeQuery = RouteQueryBuilder.create(routeConfig.origin, routeConfig.destination)
        .withMaxAlternatives(MAX_ALTERNATIVES)
        .withReport(Report.NONE)
        .withInstructionsType(InstructionsType.NONE)
        .withConsiderTraffic(false)
        .withAvoidArea(avoidArea)
        .build()
image

Route without avoiding anything

image

Route avoiding a specified area

image

Route avoiding vignettes