Routes And Directions
Return a route line for display, distance, duration, and legs and steps that describe the journey. Useful for appointment directions and trip previews.
01 / Overview
Origin + destination + optional stops
↓
A route, journey details, and travel estimate
Origins × destinations
↓
Travel times and distances for each pair
Documentation: Compute Routes · Compute Route Matrix
02 / Core Features
Return a route line for display, distance, duration, and legs and steps that describe the journey. Useful for appointment directions and trip previews.
Offer up to three alternatives alongside the default route when available. Alternatives require a journey without intermediate stops and are unavailable in Route Matrix.
Reorder intermediate stops while keeping the origin and final destination fixed. Useful for a technician visiting several sites or a courier completing a small round.
Request avoidance of tolls, highways, or ferries where supported. Heading and side-of-road options help express how a vehicle approaches a pickup or drop-off.
Documentation: Journey Details · Alternatives · Stop Ordering · Route Options
03 / Traffic And Travel Modes
| Traffic Preference | What It Does | Example Fit |
|---|---|---|
| Traffic Unaware | Ignores current traffic; prioritizes a fast response. | An initial distance or approximate journey comparison. |
| Traffic Aware | Includes traffic with optimizations for response speed. | A booking flow or a list of nearby service providers. |
| Traffic Aware Optimal | Performs a more extensive traffic-aware route search, with higher latency. | A detailed journey decision before departure. |
For a future departure, historical patterns become more influential as the departure time moves farther away. A traffic-aware duration is an estimate for the requested conditions; loading, service time, and customer delays must be added by your application.
Driving supports road journeys. Motorized two-wheel routing is a distinct mode with regional coverage; it is not bicycle routing.
Transit can include stops, lines, arrival/departure times, and walking connections. Preferences can favor less walking or fewer transfers. Transit does not support intermediate waypoints or driving traffic preferences.
Documentation: Traffic Settings · Transit · Travel Modes And Warnings
04 / Route Matrix
Compare travel times from a customer to candidate stores, clinics, or pickup points. Your application can then filter for opening hours, stock, or appointment availability.
Compare eligible workers or depots with job locations. Combine travel estimates with your own skills, capacity, shifts, and service rules before making an assignment.
| You Need | Use | Result |
|---|---|---|
| Travel Times Across Candidates | Compute Route Matrix | One distance and duration per origin–destination pair. |
| A Selected Journey With Directions | Compute Routes | Route geometry and requested journey details. |
| Assignments Across Vehicles | Route Optimization API | A separate service for fleet planning with objectives and constraints. |
Documentation: Matrix Use Cases · Limits And Errors · Fleet Optimization
05 / Use Cases
Compare depots to a delivery address, then calculate the chosen journey. Add inventory, preparation time, and loading time before showing a delivery window.
Rank qualified technicians by travel time, then calculate their journey or order a set of stops. Keep skills, shifts, and appointment windows in your scheduling logic.
Sort a shortlist by travel time instead of straight-line proximity. Show opening hours and availability alongside the journey estimate.
Help guests compare arrival options and preview directions. Transit details can explain transfers and the walk from a station to a venue.
Estimate the trip and show available route choices before booking. Your service still supplies vehicle availability, pricing, matching, and live trip operations.
Compare travel times from a defined set of customer or service areas to candidate sites. Test multiple departure times; combine the result with demand and site-specific evidence.
Documentation: Route Capabilities · Comparisons · Transit Details
06 / Worked Example
| Origin | Job A | Job B | Job C |
|---|---|---|---|
| North Depot | 12 min | 24 min | 18 min |
| South Depot | 20 min | 10 min | 16 min |
North is quicker for A; South is quicker for B and C. These are pairwise travel estimates, not a complete delivery schedule.
If South lacks stock for C, North may be the feasible choice despite its longer trip. Do not select the smallest number without checking eligibility.
Use Compute Routes for the chosen origin and destination. Add stop ordering only when planning a compatible journey with several stops.
For Job C, select North when South has no stock. Estimated driving time: 18 minutes. With an assumed 8-minute preparation time, the application estimates 26 minutes before arrival, excluding other delays.
18 + 8 = 26 minutes. Routes API supplies the travel component; the application supplies preparation time. No fleet-wide assignment has been solved.
Documentation: Pairwise Results · Stop Ordering
07 / Specialized Features
Estimate tolls in supported locations using relevant pass information. Useful when comparing trip costs. An unknown toll amount must remain unknown; the documented estimated prices apply to non-commercial vehicles and can differ for commercial vehicles.
Compare a fuel- or energy-efficient driving route with the default route, based on engine type. Available in supported regions and marked Preview. Not supported by Route Matrix; modeled fuel estimates are for comparison, not exact consumption for a particular vehicle.
Request traffic information associated with the route polyline to help explain where congestion occurs. Your map experience renders the returned information.
Use vehicle dimensions, weight, and hazardous-material attributes for truck-specific routes and ETAs. Access is limited to provisioned customers. Coverage: contiguous 48 United States (GA) and Japan (Experimental). Truck toll prices are unsupported.
Documentation: Tolls · Eco-Friendly Routing · Polylines · Large-Vehicle Access And Limits
08 / Product Fit
| Requirement | Where It Belongs |
|---|---|
| Calculate A Journey Or Compare Travel Times | Routes API: Compute Routes and Compute Route Matrix. |
| Find A Place Or Capture A Destination | Your location records or a place-search/address-entry experience. Pass the selected location into routing. |
| Display The Route | A map integration renders the route geometry. Follow Routes API display and attribution policies. |
| Guide A Driver During The Trip | Navigation SDK supplies an in-app navigation experience; returning route steps alone does not create that experience. |
| Allocate Jobs Across A Fleet | Route Optimization API models fleet objectives and constraints. Your operating systems supply jobs, vehicles, and rules. |
Documentation: Display And Attribution · Navigation Integration · Route Optimization
09 / Getting Started
Provide locations as place IDs, addresses, or coordinates. Specify a travel mode and relevant options. A required field mask selects the response fields your application needs.
Enable Routes API and billing in a Google Cloud project; use an API key or OAuth token. Call the service through REST or gRPC with the appropriate request and response handling.
| Billing Unit | What To Count |
|---|---|
| Compute Routes | Each route request. |
| Compute Route Matrix | Origin–destination elements: 10 origins × 20 destinations = 200 elements. |
Features determine the applicable Essentials, Pro, or Enterprise SKU. Traffic-aware requests, waypoint optimization, and certain other features raise the billing tier. Compute Routes allows up to 25 intermediate waypoints. Use the current pricing documentation for rates and regional eligibility.
Documentation: Request Overview · Billing And Quotas · Matrix Error Handling
Documentation reviewed September 14, 2026. This guide explains features and application patterns; the worked example is illustrative.