EVCarOptions

public struct EVCarOptions : Hashable

All the options to specify how a route for an electric car should be calculated. At minimum, a valid EVConsumptionModel must be set or the route calculation will fail.
Note: EVCarOptions.ensureReachability must be true to make sure that all stopovers are reachable. For this, charging stations may be added to the route. If EVCarOptions.ensureReachability is true, you need to specify the required route options and battery specifications that include the current charge level of the battery (BatterySpecifications.initialChargeInKilowattHours). See the parameter description below for more details.

  • Specifies the common route calculation options.

    Declaration

    Swift

    public var routeOptions: RouteOptions
  • Customize textual content returned from the route calculation, such as localization, format, and unit system.

    Declaration

    Swift

    public var textOptions: RouteTextOptions
  • Options to specify restrictions for route calculations. By default no restrictions are applied.

    Declaration

    Swift

    public var avoidanceOptions: AvoidanceOptions
  • Options to specify how the tolls should be calculated, such as transponders, vehicle category, and emission type.

    Declaration

    Swift

    public var tollOptions: TollOptions
  • The options explicitly allowed by user for route calculations. By default no options are opt in.

    Declaration

    Swift

    public var allowOptions: AllowOptions
  • Specifies the number of occupants in the vehicle, including driver, can affect the vehicle’s ability to use HOV/carpool restricted lanes. Shouldn’t be less than 1 or greater than 255. Defaults to 1.

    Note: This parameter has no effect unless HOV and/or HOT lane usage is enabled via EVCarOptions.allowOptions and such lanes are available in the selected country.

    Declaration

    Swift

    public var occupantsNumber: Int32
  • Specifies the last character of a vehicle’s license plate, typically used to evaluate traffic restrictions in certain environmental or low-emission zones. In cities like Bogotá, Mexico City, or Jakarta, specific license plate digits may be restricted on certain days or in certain areas to reduce congestion and emissions. When this value is provided, the HERE SDK considers it during route calculation to avoid roads or areas where your vehicle may be restricted based on local regulations. Example usage: “7”, when the license plate of a vehicle looks like “B-ET-182487”.

    If this value is not set, such license plate-based restrictions are ignored, and routing is performed without considering them.

    Declaration

    Swift

    public var lastCharacterOfLicensePlate: String?
  • Segments with restriction on maximum DynamicSpeedInfo.baseSpeedInMetersPerSecond.

    Declaration

    Swift

    public var maxSpeedOnSegments: [MaxSpeedOnSegment]
  • Ensure that the vehicle does not run out of energy along the way. Requires valid EVCarOptions.batterySpecifications. It also requires that RouteOptions.optimizationMode = OptimizationMode.fastest, RouteOptions.speedCapInMetersPerSecond is not set, and AvoidanceOptions is empty. Otherwise, this object is considered invalid. Setting this flag enables calculation of a route optimized for electric vehicles. Charging stations may be added along the route to ensure that the vehicle does not run out of energy along the way. It is especially useful for longer routes, because after all, charging stations are much less common than petrol stations. Note An [sdk.routing.RoutingError.INVALID_PARAMETER] is generated when the [sdk.routing.EVCarOptions.ensure_reachability] is set to true in case [sdk.routing.RoutingEngine.import_route] is called. Defaults to false.

    Declaration

    Swift

    public var ensureReachability: Bool
  • Vehicle specific parameters, which are then used to calculate energy consumption for the vehicle on a given route.

    Declaration

    Swift

    public var consumptionModel: EVConsumptionModel
  • Parameters that describe the electric vehicle’s battery.

    Declaration

    Swift

    public var batterySpecifications: BatterySpecifications
  • Detailed car specifications such as dimensions and weight.

    Declaration

    Swift

    public var carSpecifications: CarSpecifications
  • Defines the preferred E-Mobility Service Providers. The The E-Mobility Service Provider Partner Ids can be received from https://www.here.com/docs/bundle/ev-charge-points-api-developer-guide/page/topics/resource-roamings.html An alternative way to get partnerId is the eMobilityServiceProviders.partnerId as part of HERE SDK Search. Maximum number of E-Mobility Service Providers is limited to 10. By default, all providers are used.

    Declaration

    Swift

    public var evMobilityServiceProviderPreferences: EVMobilityServiceProviderPreferences
  • Creates a new instance.

    • Parameters

      • routeOptions: Specifies the common route calculation options.
      • textOptions: Customize textual content returned from the route calculation, such as localization, format, and unit system.
      • avoidanceOptions: Options to specify restrictions for route calculations. By default no restrictions are applied.
      • tollOptions: Options to specify how the tolls should be calculated, such as transponders, vehicle category, and emission type.
      • allowOptions: The options explicitly allowed by user for route calculations. By default no options are opt in.
      • occupantsNumber: Specifies the number of occupants in the vehicle, including driver, can affect the vehicle’s ability to use HOV/carpool restricted lanes. Shouldn’t be less than 1 or greater than 255. Defaults to 1.

      Note: This parameter has no effect unless HOV and/or HOT lane usage is enabled via EVCarOptions.allowOptions and such lanes are available in the selected country.

      • lastCharacterOfLicensePlate: Specifies the last character of a vehicle’s license plate, typically used to evaluate traffic restrictions in certain environmental or low-emission zones. In cities like Bogotá, Mexico City, or Jakarta, specific license plate digits may be restricted on certain days or in certain areas to reduce congestion and emissions. When this value is provided, the HERE SDK considers it during route calculation to avoid roads or areas where your vehicle may be restricted based on local regulations. Example usage: “7”, when the license plate of a vehicle looks like “B-ET-182487”.

      If this value is not set, such license plate-based restrictions are ignored, and routing is performed without considering them.

      • maxSpeedOnSegments: Segments with restriction on maximum DynamicSpeedInfo.baseSpeedInMetersPerSecond.
      • ensureReachability: Ensure that the vehicle does not run out of energy along the way. Requires valid EVCarOptions.batterySpecifications. It also requires that RouteOptions.optimizationMode = OptimizationMode.fastest, RouteOptions.speedCapInMetersPerSecond is not set, and AvoidanceOptions is empty. Otherwise, this object is considered invalid. Setting this flag enables calculation of a route optimized for electric vehicles. Charging stations may be added along the route to ensure that the vehicle does not run out of energy along the way. It is especially useful for longer routes, because after all, charging stations are much less common than petrol stations. Note An [sdk.routing.RoutingError.INVALID_PARAMETER] is generated when the [sdk.routing.EVCarOptions.ensure_reachability] is set to true in case [sdk.routing.RoutingEngine.import_route] is called. Defaults to false.
      • consumptionModel: Vehicle specific parameters, which are then used to calculate energy consumption for the vehicle on a given route.
      • batterySpecifications: Parameters that describe the electric vehicle’s battery.
      • carSpecifications: Detailed car specifications such as dimensions and weight.
      • evMobilityServiceProviderPreferences: Defines the preferred E-Mobility Service Providers. The The E-Mobility Service Provider Partner Ids can be received from https://www.here.com/docs/bundle/ev-charge-points-api-developer-guide/page/topics/resource-roamings.html An alternative way to get partnerId is the eMobilityServiceProviders.partnerId as part of HERE SDK Search. Maximum number of E-Mobility Service Providers is limited to 10. By default, all providers are used.

    Declaration

    Swift

    public init(routeOptions: RouteOptions = RouteOptions(), textOptions: RouteTextOptions = RouteTextOptions(), avoidanceOptions: AvoidanceOptions = AvoidanceOptions(), tollOptions: TollOptions = TollOptions(), allowOptions: AllowOptions = AllowOptions(), occupantsNumber: Int32 = 1, lastCharacterOfLicensePlate: String? = nil, maxSpeedOnSegments: [MaxSpeedOnSegment] = [], ensureReachability: Bool = false, consumptionModel: EVConsumptionModel = EVConsumptionModel(), batterySpecifications: BatterySpecifications = BatterySpecifications(), carSpecifications: CarSpecifications = CarSpecifications(), evMobilityServiceProviderPreferences: EVMobilityServiceProviderPreferences = EVMobilityServiceProviderPreferences())