停止地点の設定

特定の場所では、ドライバーが安全に停止できないことがあります(高架、フェリー、地下、その他のアクセスが制限されている場所など)。経由地機能は、車両が停車するのに適していない場所に経由地がある場合、その経由地を近くの場所に移動します。vehicleStopoverYES に設定すると、代替の場所が利用可能な場合、ルートの計算時に地点が自動的に再配置されます。

仕組み

経由地の優先度は、その経由地のウェイポイントを作成するときに設定します。これを行うには、次の例に示すように、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){...}];