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

Route avoids

Route avoids

Allow your users to plan a route that avoids things like toll roads, motorways, ferries, unpaved roads, carpool lanes, and roads that they have already taken.

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 those motorways, so you can take the best route.

You can use parameters like:

  • tollRoads

  • motorways

  • ferries

  • unpavedRoads

  • carpools

  • alreadyUsedRoads

_

let query = TTRouteQueryBuilder.create(withDest: TTCoordinate.OSLO(), andOrig: TTCoordinate.AMSTERDAM())
    .withAvoidType(.motorways)
    .build()
routePlanner.plan(with: query)
TTRouteQuery *query = [[[TTRouteQueryBuilder createWithDest:[TTCoordinate OSLO] andOrig:[TTCoordinate AMSTERDAM]] withAvoidType:TTOptionTypeAvoidMotorways] build];
[self.routePlanner planRouteWithQuery:query];

 

image

Route avoid motorways

image

Route avoid toll roads

image

Route avoid ferries

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:

_

let vignettesArray = ["HUN", "CZE", "SVK"]
dispatchGroup.enter()
let query2 = TTRouteQueryBuilder.create(withDest: TTCoordinate.ROMANIA(), andOrig: TTCoordinate.CZECH_REPUBLIC())
    .withTraffic(false)
    .withAvoidVignettesArray(vignettesArray)
    .build()
NSArray<NSString *> *vignettesArray = @[ @"HUN", @"CZE", @"SVK" ];
TTRouteQuery *query2 = [[[[TTRouteQueryBuilder createWithDest:TTCoordinate.ROMANIA andOrig:TTCoordinate.CZECH_REPUBLIC] withTraffic:NO] withAvoidVignettesArray:vignettesArray] build];

 

To avoid an area:

_

let boundingBox = TTLatLngBounds(seBounds: TTCoordinate.ARAD_TOP_LEFT_NEIGHBORHOOD(), nwBounds: TTCoordinate.ARAD_BOTTOM_RIGHT_NEIGHBORHOOD())
var boundingBoxArray = [boundingBox]
let query2 = TTRouteQueryBuilder.create(withDest: TTCoordinate.ROMANIA(), andOrig: TTCoordinate.CZECH_REPUBLIC())
    .withAvoidArea(&boundingBoxArray, count: UInt(boundingBoxArray.count))
    .withTraffic(false)
    .build()
TTLatLngBounds boundingBox[1];
boundingBox[0] = TTLatLngBoundsMake([TTCoordinate ARAD_TOP_LEFT_NEIGHBORHOOD], [TTCoordinate ARAD_BOTTOM_RIGHT_NEIGHBORHOOD]);
TTRouteQuery *query2 = [[[[TTRouteQueryBuilder createWithDest:TTCoordinate.ROMANIA andOrig:TTCoordinate.CZECH_REPUBLIC] withTraffic:NO] withAvoidArea:boundingBox count:1] build];

 

image

Route no avoids

image

Route avoid vignettes

image

Route avoid area