The Distance Matrix API provides travel distance and time for a matrix of origins
and destinations, and consists of rows containing
for each pair. Distance Matrix is available in several forms:
- as a standalone API
- for server-side use as part of the Client Libraries for Google Maps Web Services
What can you do with the Distance Matrix API?
The API returns information based on the recommended route between start and end points. You can request distance data for different travel modes, request distance data in different units such kilometers or miles, and estimate travel time in traffic.
For more examples, see the Distance Matrix API developer guide, which provides an introduction to using the API and reference material on the available parameters.
Why use Distance Matrix?
Use the Distance Matrix API when your solution requires distance and travel time between a large list of origin-destination points.
How to use Distance Matrix
Access the Distance Matrix API through an HTTP interface, with requests constructed as a URL string, passing origins and destinations, along with your API key.
- If you want to use one of our client libraries instead of the standalone Distance Matrix API or the client-side web service, download and install it. Learn about our client libraries.
- Choose or create a project, enable billing, and enable the Distance Matrix API. See Set up in the Cloud Console.
- Create and restrict an API key, and add it to your code. See Use an API Key.
- View a Distance Matrix request and response and try a sample request.
- Client libraries - use one of our client libraries, which include the functionality of several APIs including the Distance Matrix.
- Web service best practices - learn several best practices for using and working with the Distance Matrix.
- Release notes - see the release notes for the Distance Matrix.
- Quota and billing information - find the billing units and costs for the Distance Matrix.
- Policies and restrictions - understand the restrictions on using the Distance Matrix.
From our Terms of Service
Innovate, but don't
Don't make a substitute for Google Maps. If your app's primary purpose is navigation, a business directory, or a general purpose "maps app", it's a substitute for Google Maps.