停车偏好设置

在某些地方,司机无法安全停车(例如,高架区域、渡轮、地下位置和其他限制进入的区域)。如果途经点的位置不适合车辆停靠,途经点功能会将该途经点重新定位到附近的位置。如果您将 vehicleStopover 设置为 YES,系统会在计算路线时自动重新定位航点(如果存在替代位置)。

运作方式

您可以在为经停点创建途经点时设置经停偏好设置。 为此,请在 GMSNavigationMutableWaypoint 上设置经停点的偏好设置,如以下示例所示:

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){...}];