Overview
Along with specifying the origin and destination, you can also use many of the options available for routes to customize a route matrix. The following table lists the options available for route matrix requests, and calls out any differences between the single-route and matrix methods.
Option | Description |
---|---|
Travel mode | The mode of travel, such as drive, transit, walk, bicycling, or two-wheeled vehicle. |
Specify how and if to include traffic data | Include traffic data for more accurate results, or exclude it for a faster response.
Because the computeRouteMatrix processes many routes simultaneously, using the highest
quality setting, TRAFFIC_AWARE_OPTIMAL , imposes a strict request limit on the
total number of elements (origins × destinations) you can calculate in a single call. This
limitation exists to prevent excessive latency. |
Calculate toll fees for a route matrix | When working with tolls in the RouteMatrix , the process is fundamentally the
same as calculating tolls for a single route, but with one key difference in scope: the
computeRouteMatrix method provides only the aggregated toll information for each
complete Origin-Destination pair. Unlike the single computeRoutes method, which
can return detailed toll information broken down by individual route legs (segments between
waypoints), the route matrix response summarizes the total estimated toll cost for the entire
trip between the origin and destination. You still enable toll calculation by setting
extraComputations to TOLLS and defining vehicle and toll pass
information by setting the origin's routeModifiers , but the resulting
travelAdvisory.tollInfo applies to the full route, not its individual components.
|
Request localized values | You request localized text for your route matrix response in the same
way as for a route, using a field mask. When requesting localized text for duration and
distance, both the single-route and matrix methods support explicitly setting the
languageCode and units (for example, METRIC or
IMPERIAL ). However, if these parameters are not set, the computeRoutes
method attempts to infer the language and distance units directly from the origin waypoint's
geographic location, whereas the computeRouteMatrix method defaults to English
(en-US ) for language and Metric (METRIC ) for units, regardless of
the origin's location. Therefore you must explicitly set the localization parameters when
using RouteMatrix to override its default behavior. |
Available route matrix vehicle types | Additional options for selecting the type of vehicle for the route matrix. |
Additional options | To specify additional options, such as the departure time, see ComputeRouteMatrixRequest. |