Flexible Mode

Summary of Capabilities & Limitations for this mode:
+ Custom options
+ Time Awareness (including Live Traffic)
+ Unlimited Region
- Limited Matrix Size

Given a list of origins and a list of destinations, the service computes the shortest travel times or distances between every pair of origin and destination. These results make up the entries of the routing matrix.

Size Limitations

In order to provide support for custom routing options, time awareness, and routes of arbitrary length, Flexible Mode cannot benefit from the optimizations that give Region and Profile modes their high performance. Due to this performance limitation, Flexible Mode requests are limited to:

  • at most 15 origins and 100 destinations (15 x 100)
  • or at most 100 origins and 1 destination (100 x 1)


While the service attempts to calculate any request that meets the above size limitations, it may fail to complete some synchronous requests within the time limit. For example, larger matrices, or longer routes, or routes in denser road networks, all require more computation.

In case your synchronous request times out, try one of the following:

Formulating a request

Flexible Mode is utilized when:

  • the region definition type = world
  • and no profile parameter is specified

The service applies live and historical traffic information unless explicitly disabled by setting departureTime to the special value any.

Below is an example of a 3x3 matrix request with the following origins and destinations:

  1. San Francisco at (37.76, -122.42)
  2. New York at (40.63, -74.09)
  3. Austin at (30.26, -97.74)
Matrix Request in the United States
Figure 1. Matrix Request in the United States

To calculate a car distance matrix, you can use the request below. Since the request does not specify a destinations array, the origins are taken as destinations and the resulting matrix is a 3 x 3 matrix. The region definition is the special variant world. By default the service calculates a travel times matrix, but since we want to get distances in the response instead of times, the request specifies the matrixAttributes property with the value distances.

    "origins": [
        { "lat": 37.76, "lng": -122.42 },
        { "lat": 40.63, "lng": -74.09 },
        { "lat": 30.26, "lng": -97.74 }
    "regionDefinition": {
        "type": "world"
    "matrixAttributes": ["distances"]

The full procedure of submitting a matrix request is described in the Send a Request section. The response looks like this:

    "matrixId": "d3f94d55-65a0-4b73-94f7-f65817b09980",
    "matrix": {
        "numOrigins": 3,
        "numDestinations": 3,
        "distances": [
    "regionDefinition": {
        "type": "world"

The calculated routing matrix is:

orig\dest 1 2 3
1 0 4708189 2835632
2 4702095 0 2829359
3 2837455 2835478 0

results matching ""

    No results matching ""