Available route matrix vehicle types

  • The Routes API offers route matrix calculations for various vehicle types, defaulting to driving if unspecified.

  • Supported vehicle types include driving, two-wheeled vehicles, transit, and walking, with bicycling excluded for route matrixes.

  • Two-wheeled, walking, and bicycling routes are in beta and require a user-displayed warning due to potential path inaccuracies.

  • Transit route matrixes leverage available public transportation like buses, subways, and trains within the specified region.

European Economic Area (EEA) developers

You can get a route matrix for different types of vehicles. To set the mode of travel in a computeRouteMatrix HTTP POST request, pass the travelMode field in the JSON request body using a RouteTravelMode enum value. If you don't specify a travelMode value, the Routes API uses the default of DRIVE.

You can choose driving, two-wheeled vehicles, transit, trucks, or walking. Bicycling (BICYCLE) isn't supported for route matrixes.

Vehicle type RouteTravelMode value Description
Drive DRIVE Compute a driving route matrix. DRIVE is the default if you don't specify a vehicle type.
Two-wheeled vehicle TWO_WHEELER You specify a route matrix for a two-wheeled motorized vehicle the same way you specify it for a route, using the travelMode field.
Transit TRANSIT Get a transit route matrix that uses the public transportation options available in the region. Transit options can include buses, subways, and trains, among others.
Truck TRUCK Calculate travel times and distances for a matrix of origins and destinations using large vehicle routing. Specify the physical attributes of your vehicles in origins[].routeModifiers.vehicleInfo to get accurate estimates that account for weight, height, and hazardous materials restrictions.
Walk WALK Compute a walking route matrix.

Specify the travel mode in a request

To specify a travel mode in a computeRouteMatrix request, set the travelMode field in the HTTP POST JSON request body and include the required X-Goog-FieldMask header to select the RouteMatrixElement response fields you need. If you're migrating from the legacy Distance Matrix API, the travelMode field in the POST JSON request body replaces the legacy mode URL query parameter. For more information, see Migrate to the Routes API.

curl -X POST -d '{
  "origins": [
    {
      "waypoint": {
        "location": {
          "latLng": {
            "latitude": 37.420761,
            "longitude": -122.081356
          }
        }
      }
    }
  ],
  "destinations": [
    {
      "waypoint": {
        "location": {
          "latLng": {
            "latitude": 37.420999,
            "longitude": -122.086894
          }
        }
      }
    }
  ],
  "travelMode": "WALK"
}' \
-H 'Content-Type: application/json' -H 'X-Goog-Api-Key: YOUR_API_KEY' \
-H 'X-Goog-FieldMask: originIndex,destinationIndex,duration,distanceMeters,status,condition' \
'https://routes.googleapis.com/distanceMatrix/v2:computeRouteMatrix'