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

Batch routing

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 Online 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 Online 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 request a batch query create a BatchRoutingQuery:


return BatchRoutingQueryBuilder.create()
val routeQuery = BatchRoutingQueryBuilder.create()
        .withRouteQuery(createRouteTravelModesQuery(TravelMode.CAR, AmsterdamToRotterdamRouteConfig()))
        .withRouteQuery(createRouteTravelModesQuery(TravelMode.TRUCK, AmsterdamToRotterdamRouteConfig()))
        .withRouteQuery(createRouteTravelModesQuery(TravelMode.PEDESTRIAN, AmsterdamToRotterdamRouteConfig()))


and pass it to the Routing API:


Disposable subscribe = routePlannerAPI.planBatchRoute(query)


Setup of the common params for the Batch Routing query:


return RouteQueryFactory.createRouteTravelModesQuery(travelMode, getRouteConfig());
val routeQuery = RouteQueryBuilder.create(routeConfig.origin, routeConfig.destination)


The result can be observed with a listener or by rx java subscription:

 * The listener for response of the query sent to Batch Routing online service.
public interface BatchableRoutingResultListener {

     * Triggered when the response from the batch routing online service will be available.
     * @param response - The information returned is a container for all route results.
    void onBatchResult(BatchRoutingResponse response);

     * Triggered when the online request for batch routing failed.
     * @param exception the exception returned when the request to service fails.
    void onBatchError(ServiceException exception);

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 compound query:


Secondly, pass the created query to the routing api:

Disposable subscribe = getRoutePlannerAPI().planBatchRoute(query)
                batchRoutingResponse -> displayRouteAndSetDescription(batchRoutingResponse),
                throwable -> proceedWithError(throwable.getMessage()));

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