Routing calculates the ideal path between two locations or for a matrix of origin and destination locations, and returns distances and travel times. The quality of this information and the timely delivery of it are essential to a quality consumer experience.
The Routes API contains two main feature areas:
- Compute Routes: Calculate directions between locations with comprehensive, global routing data and real-time traffic. If you are currently using the Directions API, you can now use Compute Routes.
- Compute Route Matrix: Calculate distance and travel time for a list of origin/destination pairs. If you are currently using the Distance Matrix API, you can now use Compute Route Matrix.
Try the demo to see the Routes API in action.
New features and enhancements of the Routes API
The Routes API includes performance-optimized APIs that provide many new features and enhancements over the current Directions API and Distance Matrix API, including:
Reduced response latency.
Two-wheel motorized vehicle support (for example, motorcycles). Two-wheel travel mode differs from the bicycle travel mode, which is a human-powered travel mode.
Configure eco-friendly routes to estimate the most fuel or energy-efficient route based on your vehicle's engine type.
Customizing the response details by specifying a field mask. Field masking ensures that you do not request unnecessary data, which helps to avoid unnecessary processing time and billing charges.
Setting fine-grained options for traffic calculation, letting you make quality vs latency trade off decisions.
Smart waypoints to specify pass through vs terminal locations and safe stopover locations
Requesting toll information in the response, along with route distance and ETA.
For the Compute Route Matrix feature, streaming elements of the response before the entire matrix has been calculated, lowering response latency.
Increased the limit of elements (number of origins × number of destinations) per server-side request for Compute Route Matrix feature from 100 to 625.
Use Compute Routes to calculate directions between a source and a destination. The route can contain a single source and destination, intermediate stops, and route modifiers for more accurate ETAs.
With Compute Routes you can:
- Search for directions for several modes of transportation, including driving, two-wheel vehicles, walking, or cycling.
- Return multipart directions using a series of waypoints.
- Specify origins, destinations, and waypoints as place IDs or as latitude/longitude coordinates for locations where Place IDs are not available.
Compute Routes returns the most efficient routes when calculating directions. Travel time is the primary factor optimized, but Compute Routes may also take into account other factors such as distance, number of turns and many more when deciding which route is the most efficient.
For more information, see Compute a route.
Compute Route Matrix
Compute Route Matrix provides travel distance and time for a matrix of origins and destinations. Use Compute Route Matrix to calculate the duration and distance for each origin/destination pair in the matrix.
You can request distance data for different travel modes and estimate travel time in traffic.
For more information, see Compute a route matrix.
Migrate existing apps
If you have existing apps using the Directions API and Distance Matrix API, you can migrate them to use the new Compute Routes and Compute Route Matrix features of the Routes API. See the Routes API migration guide for information on how to migrate your existing apps to use these new features.