We rolled out a new and better SDK for you.

Batch routing

Allow your users to send multiple synchronous routing requests with Batch Routing components. You can mix different types of routing requests to easily compare them.

Batch Routing components as described use the Batch Routing API so you can find all details about it in the service documentation.

Sample use case: You are preparing for a trip and you would like to choose the most optimal route for your travel. You would like to compare the ETA and distances for routes depending on travel modes, route types, or avoids.

Also, you can adjust the batch request with other parameters as described in the Batch Routing API or the JavaDocs of this SDK under the API reference section.

The following example shows multiple routes requested in the batch. Each example sends three requests in one batch. All examples allow a user to compare routes visually on the map, their ETAs, and distances by clicking a chosen route.

  • Travel mode example shows three routes: the route by car, the route by truck, and the route as a pedestrian.
  • Route type example shows three routes: the fastest route, the shortest route, and the most eco route.
  • Avoids example shows three routes: the avoid-motorways route, the avoid-ferries route, and the avoid-toll roads.

Use the following code sample to implement a similar use case.

To obtain a batch routes plan create a BatchRoutesSpecification:

1return new BatchRoutesSpecification.Builder()
2 .routeSpecifications(routeSpecifications)
3 .build()
1val batchRoutesSpecification = BatchRoutesSpecification.Builder()
2 .routeSpecifications(
3 listOf(
4 createRouteTravelModesSpecification(TravelMode.CAR, AmsterdamToRotterdamRouteConfig()),
5 createRouteTravelModesSpecification(TravelMode.TRUCK, AmsterdamToRotterdamRouteConfig()),
6 createRouteTravelModesSpecification(TravelMode.PEDESTRIAN, AmsterdamToRotterdamRouteConfig())
7 )
8 ).build()

and pass it to the Routing API:

routingApi.planRoutes(specification, batchRoutesCallback);
routingApi.planRoutes(batchRoutesSpecification, batchRoutesCallback)

The result can be observed with a listener or through a synchronous call:

2 * Callback which informs about a received [BatchRoutesPlan] or respective error.
3 */
4@PublicPreview(byTheEndOf = "2021.06")
6interface BatchRoutesCallback {
7 /**
8 * Called when a [BatchRoutesPlan] has been successfully obtained.
9 *
10 * @param routePlan The planned routes.
11 */
12 @PublicPreview(byTheEndOf = "2021.06")
13 fun onSuccess(routePlan: BatchRoutesPlan)
15 /**
16 * Called when an error occurs during the process of obtaining the [BatchRoutesPlan].
17 *
18 * @param error Error which occurred while obtaining the [BatchRoutesPlan].
19 */
20 @PublicPreview(byTheEndOf = "2021.06")
21 fun onError(error: RoutingException)


Travel modes: car, truck, pedestrian


Route type: fastest, shortest, eco


Avoids: motorways, ferries, toll roads

You can select a route and get information about ETA and distances.

Sample use case: You are preparing the trip for the weekend and you want to check how far you can get by electric car, electric car with time budget, and non-electric car.

To achieve this you first have to create a specification and pass a list of ReachableRangeSpecifications:

1new BatchRoutesSpecification.Builder()
2 .reachableRangeSpecifications(batchRoutesSpecifications)
3 .build();

Secondly, pass the created specification to the Routing API:

getRoutePlannerAPI().planRoutes(batchRoutesSpecification, batchRoutesCallback);

This example shows how Reachable Range calculations for multiple vehicle types and time budgets can be retrieved with a single request to the Batch Routing service. For each vehicle type, you can see how its type and time budget will affect ranges returned as a result. These ranges are then visualised as polylines on the map. You can obtain the description of each reachable range by clicking the polylines.


Three possible reachable ranges from Amsterdam by electric car, combustion, and electric car with a time budget for 2 hours