Page Summary
-
Truck Routing is exclusively available within the
OptimizeToursservice, and requests for this feature are made using theOptimizeToursRequestmessage. -
Specific fields for Truck Routing are located in the
VehicleInfomessage, and when these fields are used, theVehicle.TravelModemust be set to "TRUCK". -
All
OptimizeToursrequests are billed in the same manner, regardless of whether they include Truck Routing specifications or not. -
Long-haul truck routes of 500 kilometers or more may require more processing time and yield lower-quality data, so limiting distances between locations is recommended for optimal results.
-
OptimizeToursrequests, including those utilizing Truck Routing, can be submitted via REST or gRPC, with the example showing a request sent synchronously usingcurl.
Large vehicle routing is a set of properties that lets you optimize fleet routes for large vehicles by specifying physical dimensions, weight, and trailer counts. The API uses these attributes to calculate feasible paths that avoid restricted roads, low bridges, or weight-limited routes.
With large vehicle routing, you can solve fleet logistics challenges for heavy and large vehicles, for example:
- Avoid road hazards: Generate route plans that steer vehicles away from low overhead clearances, weight-restricted roads, and other physical hazards.
- Specify detailed vehicle information: Incorporate precise dimensions, total weight, axle counts, and trailer configurations into fleet-wide route plans.
- Improve fleet-wide planning: Build efficient route plans for your entire truck fleet while ensuring that all assignments comply with physical road constraints.
Limitations
Before you begin, you must be aware of the following limitations and requirements.
- Geographic availability: Large vehicle routing is available only in the contiguous 48 United States.
- Driver advisory and safety: Drivers must not rely solely on routes returned by this API to be safe or legal. Routes are not guaranteed to be appropriate for the vehicle, and following them may expose drivers to hazards such as low bridges or roads where large vehicles are prohibited.
- Best-effort routes: In some cases, the API cannot find a route that fully complies with travel restrictions. Instead, it returns a "best effort" route that may still traverse restricted areas.
- Unsupported features: Large vehicle routing does not support the following:
- Truck toll prices
- Speed limits
- Routing for radioactive hazardous materials
- Billing: Google bills all
optimizeToursrequests uniformly, regardless of whether the requests configure large vehicle routing properties. - Long-haul routes: Long-haul truck routes spanning 500 or more kilometers
require more computation time than shorter routes, and they might return
lower-quality route data. To maintain route quality, limit distances between
shipments, vehicle start locations, and vehicle end locations. If you
require long routes, increase your request deadlines to reduce the
likelihood of
DEADLINE_EXCEEDEDerrors.
Properties
To use large vehicle routing properties, you must configure a vehicle with its physical dimensions and set its routing mode to truck.
The following table lists the top-level properties for configuring large vehicle routing:
| Property | Type | Requirement | Description |
|---|---|---|---|
travelMode |
string | Required | Specifies the travel mode for the vehicle. To enable large vehicle routing properties, set this value to TRUCK. |
routeModifiers |
object | Required | Contains route-specific configurations, including vehicleInfo. |
vehicleInfo
The vehicleInfo object contains the physical specifications of the
vehicle. Define this object within the routeModifiers property.
Providing the vehicleInfo object is required if you set
travelMode to TRUCK.
The following table lists the properties available within the vehicleInfo
object:
| Property | Type | Requirement | Description |
|---|---|---|---|
totalHeightMm |
integer | Required | Specifies the total height of the vehicle in millimeters. This value must be a positive integer. |
totalWidthMm |
integer | Required | Specifies the total width of the vehicle in millimeters. This value must be a positive integer. |
totalWeightKg |
integer | Required | Specifies the total weight of the vehicle in kilograms. This value must be a positive integer. |
totalLengthMm |
integer | Required | Specifies the total length of the vehicle in millimeters. This value must be a positive integer. |
trailerInfo |
array | Optional | Contains an array of trailer specifications, which includes the lengthMm property to specify the length of each individual trailer in millimeters. |
totalAxleCount |
integer | Required | Specifies the total number of axles on the vehicle. This value must be an integer greater than or equal to 2. |
Examples
This section covers two types of examples:
- Code sample that illustrates the structure of large vehicle routing.
- A request example that includes the feature.
Code sample
The following example shows the structure of the properties used for large vehicle routing:
"vehicles": [ { "travelMode": "TRUCK", "routeModifiers": { "vehicleInfo": { "totalHeightMm": TOTAL_HEIGHT_MM, "totalWidthMm": TOTAL_WIDTH_MM, "totalWeightKg": TOTAL_WEIGHT_KG, "totalLengthMm": TOTAL_LENGTH_MM, "trailerInfo": [ { "lengthMm": TRAILER_LENGTH_MM } ], "totalAxleCount": TOTAL_AXLE_COUNT } } } ]
Request example
The following example shows the structure of a basic optimizeTours
request incorporating large vehicle routing:
{ "model": { "shipments": [ { "pickups": [ { "arrivalLocation": { "latitude": 40.953523, "longitude": -72.2277846 } } ], "deliveries": [ { "arrivalLocation": { "latitude": 40.9546673, "longitude": -72.2580151 } } ] } ], "vehicles": [ { "travelMode": "TRUCK", "routeModifiers": { "vehicleInfo": { "totalHeightMm": 4000, "totalWidthMm": 2500, "totalWeightKg": 9000, "totalLengthMm": 20000, "trailerInfo": [ { "lengthMm": 15000 } ], "totalAxleCount": 5 } }, "costPerKilometer": 1.0 } ] } }