GoogleNavigation Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
GMSNavigationRoutingOptions
@interface GMSNavigationRoutingOptions : NSObject <NSCopying, NSMutableCopying>
An immutable class that contains options related to routing logic (e.g., routing strategy).
-
Specifies the ranking order of routes, either by time, or by distance.
-
The alternate routes strategy used when setting destinations.
-
An array of target distances. A target distance is used to rank routes to a destination by the
absolute delta to it from smallest to largest. The elements should be non-negative integers.
Don’t set GMSNavigationAlternateRoutesStrategy
and this field at the same time.
Target distance is only supported for the first destination for now. So only put one
positive integer in the array. If the first element is not a positive integer, the
routing strategy defaults to the best routing strategy.
Declaration
Swift
var targetDistancesMeters: [NSNumber]? { get }
Objective-C
@property (nonatomic, readonly, nullable) NSArray<NSNumber *> *targetDistancesMeters;
-
Initializes the routing options with routing strategy.
Parameters
routingStrategy
|
Routing strategy that specifies the order of returned routes.
|
-
Initializes the routing options with an alternate routes strategy.
Parameters
alternateRoutesStrategy
|
Alternate routes strategy that determines the number of returned
alternate routes.
|
-
Initializes the routing options with target distances, and sets the routing strategy to
GMSNavigationRoutingStrategyDeltaToTargetDistance
. Ensure that target distances are always
up-to-date when used.
Declaration
Swift
init(targetDistancesMeters: [NSNumber])
Objective-C
- (nonnull instancetype)initWithTargetDistancesMeters:
(nonnull NSArray<NSNumber *> *)targetDistancesMeters;
Parameters
targetDistancesMeters
|
Target distances for destinations. Each target distance is
used to rank the routes to its corresponding destination by its absolute delta to
the routes.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-27 UTC.
[null,null,["Last updated 2025-08-27 UTC."],[[["\u003cp\u003e\u003ccode\u003eGMSNavigationRoutingOptions\u003c/code\u003e is an immutable class used to define routing logic preferences, such as route ranking and alternate route generation, in navigation.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can specify routing strategies based on time or distance, control the number of alternate routes, and even set target distances for route ranking.\u003c/p\u003e\n"],["\u003cp\u003eInitialization methods allow for setting the desired routing behavior using \u003ccode\u003eGMSNavigationRoutingStrategy\u003c/code\u003e, \u003ccode\u003eGMSNavigationAlternateRoutesStrategy\u003c/code\u003e, or target distances.\u003c/p\u003e\n"],["\u003cp\u003eWhen using target distances for route ranking, it's crucial to keep them updated for optimal results, and currently, target distance is only supported for the first destination.\u003c/p\u003e\n"]]],[],null,["# GoogleNavigation Framework Reference\n\nGMSNavigationRoutingOptions\n===========================\n\n @interface GMSNavigationRoutingOptions : NSObject \u003cNSCopying, NSMutableCopying\u003e\n\nAn immutable class that contains options related to routing logic (e.g., routing strategy).\n- `\n ``\n ``\n `\n\n ### [routingStrategy](#/c:objc(cs)GMSNavigationRoutingOptions(py)routingStrategy)\n\n `\n ` \n Specifies the ranking order of routes, either by time, or by distance. \n\n #### Declaration\n\n Swift \n\n var routingStrategy: ../Enums/GMSNavigationRoutingStrategy.html { get }\n\n Objective-C \n\n @property (nonatomic, readonly) ../Enums/GMSNavigationRoutingStrategy.html routingStrategy;\n\n- `\n ``\n ``\n `\n\n ### [alternateRoutesStrategy](#/c:objc(cs)GMSNavigationRoutingOptions(py)alternateRoutesStrategy)\n\n `\n ` \n The alternate routes strategy used when setting destinations. \n\n #### Declaration\n\n Swift \n\n var alternateRoutesStrategy: ../Enums/GMSNavigationAlternateRoutesStrategy.html { get }\n\n Objective-C \n\n @property (nonatomic, readonly) ../Enums/GMSNavigationAlternateRoutesStrategy.html alternateRoutesStrategy;\n\n- `\n ``\n ``\n `\n\n ### [targetDistancesMeters](#/c:objc(cs)GMSNavigationRoutingOptions(py)targetDistancesMeters)\n\n `\n ` \n An array of target distances. A target distance is used to rank routes to a destination by the\n absolute delta to it from smallest to largest. The elements should be non-negative integers.\n Don't set [GMSNavigationAlternateRoutesStrategy](../Enums/GMSNavigationAlternateRoutesStrategy.html) and this field at the same time.\n Target distance is only supported for the first destination for now. So only put one\n positive integer in the array. If the first element is not a positive integer, the\n routing strategy defaults to the best routing strategy. \n\n #### Declaration\n\n Swift \n\n var targetDistancesMeters: [NSNumber]? { get }\n\n Objective-C \n\n @property (nonatomic, readonly, nullable) NSArray\u003cNSNumber *\u003e *targetDistancesMeters;\n\n- `\n ``\n ``\n `\n\n ### [-initWithRoutingStrategy:](#/c:objc(cs)GMSNavigationRoutingOptions(im)initWithRoutingStrategy:)\n\n `\n ` \n Initializes the routing options with routing strategy. \n\n #### Declaration\n\n Swift \n\n init(routingStrategy: ../Enums/GMSNavigationRoutingStrategy.html)\n\n Objective-C \n\n - (nonnull instancetype)initWithRoutingStrategy:\n (../Enums/GMSNavigationRoutingStrategy.html)routingStrategy;\n\n #### Parameters\n\n |-------------------------|---------------------------------------------------------------|\n | ` `*routingStrategy*` ` | Routing strategy that specifies the order of returned routes. |\n\n- `\n ``\n ``\n `\n\n ### [-initWithAlternateRoutesStrategy:](#/c:objc(cs)GMSNavigationRoutingOptions(im)initWithAlternateRoutesStrategy:)\n\n `\n ` \n Initializes the routing options with an alternate routes strategy. \n\n #### Declaration\n\n Swift \n\n init(alternateRoutesStrategy: ../Enums/GMSNavigationAlternateRoutesStrategy.html)\n\n Objective-C \n\n - (nonnull instancetype)initWithAlternateRoutesStrategy:\n (../Enums/GMSNavigationAlternateRoutesStrategy.html)alternateRoutesStrategy;\n\n #### Parameters\n\n |---------------------------------|------------------------------------------------------------------------------------|\n | ` `*alternateRoutesStrategy*` ` | Alternate routes strategy that determines the number of returned alternate routes. |\n\n- `\n ``\n ``\n `\n\n ### [-initWithTargetDistancesMeters:](#/c:objc(cs)GMSNavigationRoutingOptions(im)initWithTargetDistancesMeters:)\n\n `\n ` \n Initializes the routing options with target distances, and sets the routing strategy to\n `GMSNavigationRoutingStrategyDeltaToTargetDistance`. Ensure that target distances are always\n up-to-date when used. \n\n #### Declaration\n\n Swift \n\n init(targetDistancesMeters: [NSNumber])\n\n Objective-C \n\n - (nonnull instancetype)initWithTargetDistancesMeters:\n (nonnull NSArray\u003cNSNumber *\u003e *)targetDistancesMeters;\n\n #### Parameters\n\n |-------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|\n | ` `*targetDistancesMeters*` ` | Target distances for destinations. Each target distance is used to rank the routes to its corresponding destination by its absolute delta to the routes. |"]]