中途偏好設定

在某些地點,駕駛人無法安全停車 (例如高架道路、渡輪、地下地點和其他出入受限的區域)。如果中途點的位置不適合車輛停靠,中途點功能會將中途點重新定位到附近地點。如果將 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){...}];