Routing#
Note
Viewing documentation for the current version v1beta1.
The required Protobuf definitions can be downloaded here:
RoutingService#
The RoutingService provides point-to-point routing for vehicles of a fleet.
ComputeRoute#
rpc ComputeRoute(ComputeRouteRequest) ComputeRouteResponse
Compute a route for the given request.
Messages#
ComputeRouteRequest#
A request for a route that traverses two or more waypoints.
Field |
Type |
Description |
---|---|---|
origin |
The origin of the route (required). |
|
destination |
The destination of the route (required). |
|
via |
Zero or more via waypoints that must be traversed in the given order. The API currently allows at most 100 via points. |
|
vehicle_configuration |
Properties of the vehicle that should be routed (required). |
|
optimization_criterion |
The measure that is minimized during routing. |
ComputeRouteResponse#
A response to a ComputeRoute request.
Leg#
A leg represents the part of a route between two consecutive waypoints and contains the coordinates, travel time and length of that part.
Field |
Type |
Description |
---|---|---|
travel_time_seconds |
int32 |
The time to traverse the leg in seconds. |
length_meters |
int32 |
The length of the leg in meters. |
geometry |
A polyline that describes the geometry of the leg. |
LegOrLegWithViolations#
This message is a container for leg data. It may consist either of a plain leg or alternatively, of a leg with violations. The service only responds with a leg with violations if no alternative route without violations exists. A leg with violations means that a route could be computed but it may be problematic and must be carefully considered in the context of the service consumer’s use case. Most violations indicate that it is illegal or impossible to drive a leg according to our routing data. Consider the ViolationType of the respective violations for more details on the severity of the problem.
LegWithViolation#
A route leg that violates routing restrictions.
Field |
Type |
Description |
---|---|---|
leg |
The route leg. |
|
violations |
Restrictions violated by the leg. |
Location#
A geographic coordinate.
Field |
Type |
Description |
---|---|---|
latitude |
double |
The latitude in degrees. [-90.0, +90.0]. |
longitude |
double |
The longitude in degrees. [-180.0, +180.0]. |
Route#
A route from origin to destination traversing all given via locations (if any) in the specified order. It consists of one or more legs, each connecting two consecutive waypoints.
Field |
Type |
Description |
---|---|---|
legs |
The route sections that make up the route. |
RoutingWaypoint#
A location that a route must traverse.
Field |
Type |
Description |
---|---|---|
latitude |
double |
The latitude in degrees. [-90.0, +90.0]. |
longitude |
double |
The longitude in degrees. [-180.0, +180.0]. |
heading |
double |
The horizontal direction in degrees, measured clockwise from north. [0.0-360.0°, 0.0° = facing north, 180.0° = facing south] |
VehicleConfiguration#
Properties of a vehicle.
Field |
Type |
Description |
---|---|---|
self_driving |
bool |
Whether the vehicle is an autonomous vehicle. |
Violation#
A violation indicates an issue with a route leg. While a route could be computed, the leg violates a routing restriction.
Field |
Type |
Description |
---|---|---|
violation_type |
Describes the kind of underlying problem. |
|
start_index |
int32 |
The index in the leg’s polyline at which the geometry of this violation starts. |
coordinates_count |
int32 |
The number of successive coordinates making up the geometry of this violation. A zero would indicate that a violation has no geometry, a one that it consists of a singular point. |
Enums#
NoRouteFoundReason#
An issue that prevented a route from being computed.
Name |
Number |
Description |
---|---|---|
NO_ROUTE_FOUND_REASON_UNSPECIFIED |
0 |
A special value to indicate that a field is not set. |
NO_ROUTE_FOUND_REASON_COULD_NOT_MATCH_WAYPOINT |
1 |
A waypoint could not be matched to the road network, i.e. our map data contains no usable road within reasonable distance of the location for the given vehicle configuration. |
NO_ROUTE_FOUND_REASON_COULD_NOT_REACH_WAYPOINT |
2 |
A waypoint was not reachable from the preceding waypoint. |
OptimizationCriterion#
The optimization criterion defines if travel time or distance is minimized during routing. Note that the result may not be the route with the strictly minimal value for the criterion as the service tries to avoid certain problematic route features such as U-turns or driving through inconvenient side roads etc.
Name |
Number |
Description |
---|---|---|
OPTIMIZATION_CRITERION_UNSPECIFIED |
0 |
A special value to indicate that a field is not set. |
OPTIMIZATION_CRITERION_TIME |
1 |
Travel time is used as the main objective to be minimized during routing. Used by default when nothing else is specified. |
OPTIMIZATION_CRITERION_DISTANCE |
2 |
Driving distance is used as the main objective to be minimized during routing. |
ViolationType#
A ViolationType describes the kind of problem of a specific violation.
Name |
Number |
Description |
---|---|---|
VIOLATION_TYPE_UNSPECIFIED |
0 |
A special value to indicate that a field is not set. |
VIOLATION_TYPE_WRONG_DIRECTION_AT_ORIGIN |
1 |
The leg departs at the origin in a different direction than requested. |
VIOLATION_TYPE_WRONG_DIRECTION_AT_DESTINATION |
2 |
The leg arrives at the destination in a different direction than requested. |
VIOLATION_TYPE_LOCAL_ZONE_USED |
3 |
The leg passes through a zone that forbids through traffic. |
VIOLATION_TYPE_BLOCKED_ROAD_USED |
4 |
The leg uses one or more blocked roads. |
VIOLATION_TYPE_TIME_DEPENDENT_RESTRICTION_VIOLATED |
5 |
The leg uses a road where driving is disallowed at the current time. |
VIOLATION_TYPE_ROAD_FORBIDDEN_FOR_VEHICLE_CONFIGURATION_USED |
6 |
The leg contains roads which cannot be driven with a vehicle of the specified configuration. |
VIOLATION_TYPE_FORBIDDEN_TURN_USED |
7 |
The leg contains a turn which is illegal (or impossible) to take. |
VIOLATION_TYPE_TURN_FORBIDDEN_FOR_VEHICLE_CONFIGURATION_USED |
8 |
The leg contains a turn which cannot be driven with a vehicle of the specified configuration. |