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

Matrix routing

Matrix routing

Allow your users to send multiple synchronous routing requests with Matrix Routing components. You can calculate a matrix of route summaries for a set of routes defined with origin and destination locations to compare them in an easy way.

Matrix Routing sdk components use Online Matrix Routing API so you can find all details about it in the service documentation.

The set of origins and the set of destinations can be thought of as the column and row headers of a table and each cell in the table contains the costs of routing from the origin to the destination for that cell.
There are generally three types of use cases for Matrix Routing:

  • 1-to-many = from one origin (e.g. your current location) to many destinations (e.g. POIs)

  • many-to-many = from many origins (e.g. taxis) to many destinations (e.g. passengers)

  • many-to-1 = from many origins (e.g. ambulances) to one destination (e.g. patient)

Try out the use cases below in your app.

Sample use case: (One to many) I know a few restaurants and I would like to know to which one I can get to the fastest

1 origin – Amsterdam, 5 restaurants in Amsterdam. The shortest ETA is the active route.


One to Many

Sample use case: (Many to many) There are a few taxis and a few passengers to pick up, you would like to compare ETAs for each pairs passengers-taxis to choose the most optimal combination.

2 origins (taxies) and 2 (destinations) passengers. Render all routes for all taxies. The active routes are the ones with the shortest ETA for each pair.


Many to Many

Use the code sample below for implementing a similar use case.

To request a matrix query create a MatrixRoutingQuery:

MatrixRoutingQuery query = MatrixRoutingQueryBuilder.create(origins, destinations).build();

and pass it to the routing API:


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

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

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

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

You can obtain detailed summary of every route in matrix (eg. ETA, delay, distances).

You are here