Stopover Preference

In certain places, it's not possible for drivers to stop safely (for example, elevated areas, ferries, underground locations, and other areas of limited access). The Stopover feature relocates the waypoint to a nearby place if its location is not suitable for a vehicle to make a stop. When you set vehicleStopover to YES, the waypoint is automatically relocated when the route is calculated, if an alternate location is available.

How it works

You set the preference for a stopover when creating the waypoint for that stop. To do this, set the preference for a stopover on a GMSNavigationMutableWaypoint as shown in the following example:

Swift

CLLocationCoordinate2D location = CLLocationCoordinate2D(47.67, -122.20);
GMSNavigationMutableWaypoint *waypoint =
    GMSNavigationMutableWaypoint(withLocation: location,
                                        title: @"waypoint from location");
waypoint.vehicleStopover = YES;
mapView.navigator?.setDestinations([waypoint], routingOptions: routingOptions, callback: {...})

Objective-C

CLLocationCoordinate2D location = CLLocationCoordinate2DMake(47.67, -122.20);
GMSNavigationMutableWaypoint *waypoint =
    [[GMSNavigationMutableWaypoint alloc] initWithLocation:location
                                                     title:@"waypoint from location"];
waypoint.vehicleStopover = YES;
[_mapView.navigator setDestinations:@[waypoint1]
                     routingOptions:routingOptions
                           callback:^(GMSRouteStatus routeStatus){...}];