THIS SDK ISDEPRECATED.

We rolled out a new and better SDK for you.

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
1let query = TTRouteQueryBuilder.create(withDest: TTCoordinate.OSLO(), andOrig: TTCoordinate.AMSTERDAM())
2 .withAvoidType(.motorways)
3 .build()
4routePlanner.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:

1let vignettesArray = ["HUN", "CZE", "SVK"]
2dispatchGroup.enter()
3let query2 = TTRouteQueryBuilder.create(withDest: TTCoordinate.ROMANIA(), andOrig: TTCoordinate.CZECH_REPUBLIC())
4 .withTraffic(false)
5 .withAvoidVignettesArray(vignettesArray)
6 .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:

1let boundingBox = TTLatLngBounds(seBounds: TTCoordinate.ARAD_TOP_LEFT_NEIGHBORHOOD(), nwBounds: TTCoordinate.ARAD_BOTTOM_RIGHT_NEIGHBORHOOD())
2var boundingBoxArray = [boundingBox]
3let query2 = TTRouteQueryBuilder.create(withDest: TTCoordinate.ROMANIA(), andOrig: TTCoordinate.CZECH_REPUBLIC())
4 .withAvoidArea(&boundingBoxArray, count: UInt(boundingBoxArray.count))
5 .withTraffic(false)
6 .build()
1TTLatLngBounds boundingBox[1];
2boundingBox[0] = TTLatLngBoundsMake([TTCoordinate ARAD_TOP_LEFT_NEIGHBORHOOD], [TTCoordinate ARAD_BOTTOM_RIGHT_NEIGHBORHOOD]);
3TTRouteQuery *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