
Distance rate time calc code#
Follow best practices: Go to Web Service BestĮxcept 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.


The following table summarizes the resources available through theĭistance Matrix API along with the data it returns. Washington, DC and Boston, with a single destination, New York City, NY, in The following example shows a request for two origins: The request and proceeding step-wise to the next.įor example, if your request specifies A and B as origins, and C and D as destinations, it returns distances and travel time in this order: Origin and all requested destinations, starting with the first origin in The Distance Matrix API uses any number of origins (starting points) and destinations, and returns the distance and travel time between each You can request these kinds of distance data: The Distance Matrix API provides information based on the recommended routeīetween start and end points. Transit modes, such as bus, subway, train, tram, or rail. Mode of transportation, such as driving, biking, transit or walking, as well as You can specify several options, including With the Distance Matrix API, you can provide travel distance and time forĪ matrix of origins and destinations. What can you do with the Distance Matrix API You can get directionsįor a single origin and destination by usingĭirections API. This API is not designed to return route directions. ForĮxample, which workers to send to job sites, or from which warehouses to send Travel routes between multiple possible origins and destinations. You can use the Distance Matrix API to help determine the most efficient For eachĬombination of origin and destination, it returns travel distance and duration.

The Distance Matrix API is a service that accepts an HTTPS requestĬontaining origins and destinations for a given mode of transport.
