A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.google.com/maps/documentation/routes/compute-route-matrix-over below:

Compute Route Matrix Overview | Routes API

Compute Route Matrix Overview

Stay organized with collections Save and categorize content based on your preferences.

Compute Route Matrix is a method in the Routes API service that accepts an HTTPS request and returns distances and travel times for a matrix of routes between different origin and destination locations. Calculate travel times and distances for multiple destinations for up to 625 route elements.

Need Driving Routes? If you are interested in route directions, see Compute Routes Overview.

Migrating? If you are migrating from the Distance Matrix API (Legacy), see migration instructions starting with Why migrate to the Routes API.

Why use Compute Route Matrix

With Compute Route Matrix, you can determine the most efficient routes for dispatch scheduling, such as:

What you can do with Compute Route Matrix?

With Compute Route Matrix, you can get a matrix of possible routes between many start and end locations. You can specify multiple origins and destinations per server-side request with the number of origins times the number of destinations up to 625. You can stream elements of the response before the entire matrix has been calculated, lowering response latency.

You can request these kinds of route data to determine the most efficient way to route passengers, shipments, or workers between multiple origins and destinations:

How Compute Route Matrix works

The ComputeRouteMatrix method accepts an HTTP POST request with a JSON request body that contains the request details. Required are at least one origin, two or more destinations, travelMode, and a field mask to specify which fields to return.

Example
curl -X POST -d '{
  "origins": [
    {
      "waypoint": {
        "location": {
          "latLng": {
            "latitude": 37.420761,
            "longitude": -122.081356
          }
        }
      }
    },
    {
      "waypoint": {
        "location": {
          "latLng": {
            "latitude": 37.403184,
            "longitude": -122.097371
          }
        }
      }
    }
  ],
  "destinations": [
    {
      "waypoint": {
        "location": {
          "latLng": {
            "latitude": 37.420999,
            "longitude": -122.086894
          }
        }
      }
    },
    {
      "waypoint": {
        "location": {
          "latLng": {
            "latitude": 37.383047,
            "longitude": -122.044651
          }
        }
      }
    }
  ],
  "travelMode": "DRIVE"
}' \
-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: YOUR_API_KEY' \
-H 'X-Goog-FieldMask: originIndex,destinationIndex,duration,distanceMeters,status,condition' \
'https://routes.googleapis.com/distanceMatrix/v2:computeRouteMatrix'

The response contains the possible routes for the combination of all origin and destination waypoints.

Resources

The following table summarizes the resources available through the Routes API Compute Route Matrix method, along with the data it returns.

Data resources Data returned Return format ComputeRouteMatrix Returns an array of routes from one origin waypoint to one destination waypoint. JSON How to use Compute Route Matrix Available client libraries

For a list of the available client libraries for Compute Route Matrix, see Client libraries.

What's next

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-14 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-14 UTC."],[],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4