Specify vehicle heading and side of road

Waypoints may include location modifiers to change how routes are calculated, including settings for heading and sideOfRoad.

Specify the vehicle heading

To define a waypoint, you specify the geographic Location (REST) or Location (gRPC) as a pair of latitude/longitude coordinates.

Location also lets you specify the direction you want the vehicle to head when it arrives at each waypoint. You can use this feature to ensures that the vehicle arrives on the same side of the road as the consumer waiting to be picked up. When you don't specify a heading, the vehicle can arrive on the wrong side of the road.

Heading values are whole numbers that align with the compass directions, and therefore range from zero to 359. For example, a value of 0 indicates a heading direction of due North.

The following example demonstrates how to set a heading for a waypoint.

{
  "origin":{
    "location":{
      "latLng":{
        "latitude": 37.419734,
        "longitude": -122.0827784
      },
      "heading": 127
    }
  },
  ...

Specify a side of the road preference

You represent a location by creating a Waypoint (REST) or Waypoint (gRPC) object. A location defined by a latitude and longitude pair can correspond to a specific side of a road. However, to support route optimization, a route can still set a stopover to be on the opposite side of the road from the specified location.

Waypoints support the sideOfRoad property, which indicates that the waypoint location has a preference for the vehicle to stop at the same side of road as specified by the location.

Specify that the route uses the preferred side of the road by setting the Waypoint sideOfRoad property to true. The route then passes through the location so that the vehicle can stop at the side of road that the location is biased towards.

The following example shows how to set sideOfRoad for a waypoint.

{
  "origin":{
    "location":{
      "latLng":{
        "latitude": 37.419734,
        "longitude": -122.0827784
      }
    },
    "sideOfRoad": true
  },
  ...