Set a stop along a route

European Economic Area (EEA) developers

To set a stop along a route, for example, for a pickup or dropoff, you designate a waypoint as a stopover waypoint. To do this, use the vehicleStopover property of a waypoint. This setting ensures that the calculated route doesn't begin or end on a road that is unsuitable for pickup and drop-off, such as a highway or tunnel.

Consider the situation where a surface road crosses over a road inside a tunnel. If you were to specify a waypoint located where the two roads intersect (as seen on a map), then the resulting route would begin or end on either the surface road or the tunnel. This result presents a problem because you can't stop in tunnels to make pickups or drop-offs.

If you want to use the waypoint for a pickup or drop-off, then you can set the vehicleStopover field to true to ensure that the resulting route begins or ends on a road that allows pickups and drop-offs.

The following example request shows how to set a stopover waypoint:

const routeRequestWithIntermediates = {
  origin: 'Mountain View, CA',
  destination: 'San Francisco, CA',
  travelMode: 'DRIVING',
  intermediates: [
    {location: 'San Mateo, CA'},
    {location: 'Half Moon Bay, CA', vehicleStopover: true}
  ],
  fields: ['path', 'legs'],
};