RouteOptions

public struct RouteOptions : Hashable

The options to specify how the route will be calculated.

  • The optimization mode to be used for route calculation. By default, it is OptimizationMode.fastest.

    Declaration

    Swift

    public var optimizationMode: OptimizationMode
  • Maximum number of alternative routes that will be calculated, in addition to the best one. The provided value must be in the range [0, 6]. Alternative routes can be unavailable, thus they are not guaranteed to be returned. The order of routes is from the best to the worst, as evaluated by the route calculation algorithm and according to the given input parameters. Defaults to 0, which means there are no alternatives, i.e. only the best route is returned. Must be 0 for isoline calculation.

    Declaration

    Swift

    public var alternatives: Int32
  • Optional time when travel is expected to start. Traffic speed and incidents shall be taken into account in the calculation of the route, per RouteOptions.trafficOptimizationMode. By default, the time is not set. If the time is not set, the current time will be used internally, i.e. now. Therefore, by default, a time-aware route request is initiated including traffic.

    Note:

    • Both departure time and RouteOptions.arrivalTime cannot be set at the same time.
    • This parameter is handled as local time. Therefore, it is necessary to specify the time zone offset when setting the time in areas with different time zones, i.e. 2025-02-04T08:00:00+07:00

    Declaration

    Swift

    public var departureTime: Date?
  • Optional time when travel is expected to end. Traffic speed and incidents shall be taken into account in the calculation of the route, per RouteOptions.trafficOptimizationMode. By default, the time is not set. If the time is not set, the current time will be used internally, to predict the arrival time. Therefore, by default, a time-aware route request is initiated including traffic.

    Note:

    • Both RouteOptions.departureTime and arrival time cannot be set at the same time.
    • This parameter is handled as local time. Therefore, it is necessary to specify the time zone offset when setting the time in areas with different time zones, i.e. 2025-02-04T08:00:00+07:00

    Declaration

    Swift

    public var arrivalTime: Date?
  • Specifies the maximum speed in meters per second, which the user wishes not to exceed. The valid range is [1, 70] meters per second. Note that it is valid only for TransportMode.car, TransportMode.truck and TransportMode.scooter transport modes. For car, truck and scooter transport modes, it will affect Route.duration of the route. Only for scooter transport mode, it may affect the route geometry. Defaults to nil, which means that no speed cap is set.

    Declaration

    Swift

    public var speedCapInMetersPerSecond: Double?
  • A flag that indicates whether the resulting route should contain a RouteHandle. Defaults to false. Note that a RouteHandle generated by the online RoutingEngine is not compatible with the OfflineRoutingEngine and vice versa.

    Declaration

    Swift

    public var enableRouteHandle: Bool
  • The traffic optimization mode to be used for route calculation. By default, it is TrafficOptimizationMode.timeDependent, which enables traffic-aware routing.

    Declaration

    Swift

    public var trafficOptimizationMode: TrafficOptimizationMode
  • A flag that indicates whether the resulting route Section.tolls properties should contain tolls data. Defaults to false.

    Note: When a route calculation request asks tolls, a pricing scheme with higher rates might be applied. Consult your HERE representative to get more information on the related pricing schemes.

    Note: For users of the OfflineRoutingEngine this is a beta release of this feature, so there could be a few bugs and unexpected behaviors. The OfflineRoutingEngine is only available for the Navigate license. For users of the RoutingEngine the feature is stable.

    Declaration

    Swift

    public var enableTolls: Bool
  • A flag that indicates whether the order of waypoints that is passed to calculateRoute() should be optimized in the best order. The best order is calculated by the same metrics that are used during regular calculation, e.g. OptimizationMode. The starting and destination Waypoint are not reordered. If the whole number of waypoints is fewer than 4 - the flag doesn’t affect the resulting route (nothing to optimize). The resulting order of waypoints can be identified by their waypoint indices in the route sections (see Route.sections, Section.departurePlace, Section.arrivalPlace, RoutePlace.waypointIndex). Currently, the waypoints order optimization is available only when using the OfflineRoutingEngine (only available for the Navigate license). Defaults to false.

    Declaration

    Swift

    public var optimizeWaypointsOrder: Bool
  • Specifies whether route labels should be included in the route response. Route labels identify major highways or road names along the route. By default, this is set to false.

    Declaration

    Swift

    public var enableRouteLabels: Bool
  • Creates a new instance.

    • Parameters

      • optimizationMode: The optimization mode to be used for route calculation. By default, it is OptimizationMode.fastest.
      • alternatives: Maximum number of alternative routes that will be calculated, in addition to the best one. The provided value must be in the range [0, 6]. Alternative routes can be unavailable, thus they are not guaranteed to be returned. The order of routes is from the best to the worst, as evaluated by the route calculation algorithm and according to the given input parameters. Defaults to 0, which means there are no alternatives, i.e. only the best route is returned. Must be 0 for isoline calculation.
      • departureTime: Optional time when travel is expected to start. Traffic speed and incidents shall be taken into account in the calculation of the route, per RouteOptions.trafficOptimizationMode. By default, the time is not set. If the time is not set, the current time will be used internally, i.e. now. Therefore, by default, a time-aware route request is initiated including traffic.

      Note:

      • Both departure time and RouteOptions.arrivalTime cannot be set at the same time.
      • This parameter is handled as local time. Therefore, it is necessary to specify the time zone offset when setting the time in areas with different time zones, i.e. 2025-02-04T08:00:00+07:00
        • arrivalTime: Optional time when travel is expected to end. Traffic speed and incidents shall be taken into account in the calculation of the route, per RouteOptions.trafficOptimizationMode. By default, the time is not set. If the time is not set, the current time will be used internally, to predict the arrival time. Therefore, by default, a time-aware route request is initiated including traffic.

      Note:

      • Both RouteOptions.departureTime and arrival time cannot be set at the same time.
      • This parameter is handled as local time. Therefore, it is necessary to specify the time zone offset when setting the time in areas with different time zones, i.e. 2025-02-04T08:00:00+07:00
        • speedCapInMetersPerSecond: Specifies the maximum speed in meters per second, which the user wishes not to exceed. The valid range is [1, 70] meters per second. Note that it is valid only for TransportMode.car, TransportMode.truck and TransportMode.scooter transport modes. For car, truck and scooter transport modes, it will affect Route.duration of the route. Only for scooter transport mode, it may affect the route geometry. Defaults to nil, which means that no speed cap is set.
        • enableRouteHandle: A flag that indicates whether the resulting route should contain a RouteHandle. Defaults to false. Note that a RouteHandle generated by the online RoutingEngine is not compatible with the OfflineRoutingEngine and vice versa.
        • trafficOptimizationMode: The traffic optimization mode to be used for route calculation. By default, it is TrafficOptimizationMode.timeDependent, which enables traffic-aware routing.
        • enableTolls: A flag that indicates whether the resulting route Section.tolls properties should contain tolls data. Defaults to false.

      Note: When a route calculation request asks tolls, a pricing scheme with higher rates might be applied. Consult your HERE representative to get more information on the related pricing schemes.

      Note: For users of the OfflineRoutingEngine this is a beta release of this feature, so there could be a few bugs and unexpected behaviors. The OfflineRoutingEngine is only available for the Navigate license. For users of the RoutingEngine the feature is stable.

      • optimizeWaypointsOrder: A flag that indicates whether the order of waypoints that is passed to calculateRoute() should be optimized in the best order. The best order is calculated by the same metrics that are used during regular calculation, e.g. OptimizationMode. The starting and destination Waypoint are not reordered. If the whole number of waypoints is fewer than 4 - the flag doesn’t affect the resulting route (nothing to optimize). The resulting order of waypoints can be identified by their waypoint indices in the route sections (see Route.sections, Section.departurePlace, Section.arrivalPlace, RoutePlace.waypointIndex). Currently, the waypoints order optimization is available only when using the OfflineRoutingEngine (only available for the Navigate license). Defaults to false.
      • enableRouteLabels: Specifies whether route labels should be included in the route response. Route labels identify major highways or road names along the route. By default, this is set to false.

    Declaration

    Swift

    public init(optimizationMode: OptimizationMode = OptimizationMode.fastest, alternatives: Int32 = 0, departureTime: Date? = nil, arrivalTime: Date? = nil, speedCapInMetersPerSecond: Double? = nil, enableRouteHandle: Bool = false, trafficOptimizationMode: TrafficOptimizationMode = TrafficOptimizationMode.timeDependent, enableTolls: Bool = false, optimizeWaypointsOrder: Bool = false, enableRouteLabels: Bool = false)