RoutingOptionsBuilder
open class RoutingOptionsBuilder
RoutingOptionsBuilder builds the RoutingOptions object
Important
This is a Public Preview API. It may be changed or removed at any time.-
Sets the coordinate of the origin point
Declaration
Swift
public func with(origin: CLLocationCoordinate2D) -> Self
-
Sets the coordinate of the destination point
Declaration
Swift
public func with(destination: CLLocationCoordinate2D) -> Self
-
Sets the amount of power consumed by auxiliary systems, in kilowatts (kW).
Declaration
Swift
public func with(auxiliaryPowerInkW: Float) -> Self
-
Sets the avoid type to use in route planning.
Declaration
Swift
public func with(avoid: AvoidType) -> Self
-
Sets the array of avoid types during routing process.
Declaration
Swift
public func with(avoids: [AvoidType]) -> Self
-
Sets the array of extended route representation.
Declaration
Swift
public func with(extendedRouteRepresentation: [ExtendedRouteRepresentation]) -> Self
-
Sets the departure date/time.
Declaration
Swift
public func with(departAt: Date) -> Self
-
Sets the given vehicle load type.
Declaration
Swift
public func with(vehicleLoadType: VehicleLoadType) -> Self
-
Sets the length of the vehicle. A value of 0 means that length restrictions are not considered.
Declaration
Swift
public func with(vehicleLength: Measurement<UnitLength>) -> Self
-
Sets the width of the vehicle in meters. A value of 0 means that width restrictions are not considered.
Declaration
Swift
public func with(vehicleWidth: Float) -> Self
-
Sets height of the vehicle in meters. A value of 0 means that height restrictions are not considered.
Declaration
Swift
public func with(vehicleHeight: Float) -> Self
-
Sets the weight per axle of the vehicle in kilograms. Note: A value of 0 means that weight restrictions per axle are not considered.
Declaration
Swift
public func with(vehicleAxleWeight: Measurement<UnitMass>) -> Self
-
Sets the maximum speed of the vehicle.
Declaration
Swift
public func with(vehicleMaxSpeed: Measurement<UnitSpeed>) -> Self
-
Sets if the vehicle is used for commercial purposes and thus may not be allowed to drive on some roads. Default value: false.
Declaration
Swift
public func with(vehicleCommercial: Bool) -> Self
-
Sets the vehicle ADR tunnel restriction code If vehicleAdrTunnelRestrictionCode is specified, the vehicle is subject to ADR tunnel restrictions.
- Vehicles with code B are restricted from roads with ADR tunnel categories B, C, D, and E.
- Vehicles with code C are restricted from roads with ADR tunnel categories C, D, and E.
- Vehicles with code D are restricted from roads with ADR tunnel categories D and E.
- Vehicles with code E are restricted from roads with ADR tunnel category E.
If vehicleAdrTunnelRestrictionCode is not specified, no ADR tunnel restrictions apply. Notes: If travelMode is pedestrian or bicycle, vehicleAdrTunnelRestrictionCode is not considered. The vehicleAdrTunnelRestrictionCode and vehicleLoadType parameters are independent. Provide both if both are applicable. Values (specify at most one):
- B
- C
- D
- E Reference: European Agreement Concerning the International Carriage of Dangerous Goods by Road (ADR), United Nations, 2019, section 1.9.5 and chapter 8.6.
Declaration
Swift
public func with(vehicleAdrTunnelRestrictionCode: ADRTunnelRestrictionCode) -> Self
-
Specifies the precision of coordinates in the response. Possible values are: default: All coordinates are rounded to 5 digits after the decimal point. Default precision coordinates are targeted towards clients that are sensitive to response sizes. This should be sufficient for most applications. full: All coordinates are rounded to 7 digits after the decimal point. Full precision coordinates are targeted towards applications that require precise polyline visualization at high zoom levels.
Declaration
Swift
public func with(coordinatePrecision: CoordinatePrecision) -> Self
Parameters
coordinatePrecision
[CoordinatePrecision] Specifies the precision of coordinates in the response
Return Value
Self
-
Sets the speed-dependent component of consumption. Provided as an unordered list of speed/consumption-rate pairs. The list defines points on a consumption curve.
Consumption rates for speeds not in the list are found as follows:
- If the speed is between two speeds on the list, the rate is calculated by linear interpolation of those two points.
- If the speed is not in the range of the list, the rate is calculated by linear extrapolation, assuming a constant (&ΔConsumption/&ΔSpeed) determined by the nearest two points in the list.
The list must contain between 1 and 25 points (inclusive), and may not contain duplicate points for the same speed. If it only contains a single point, then the consumption rate of that point is used without further processing.
The consumption specified for the largest speed must be greater than or equal to that of the next highest speed. This ensures that extrapolation does not lead to negative consumption rates.
Similarly, consumption values specified for the two smallest speeds in the list cannot lead to a negative consumption rate for any smaller speed.
The minimum and maximum values described here refer to the valid range for the consumption values (expressed in kWh/100km).
Minimum value: 0.01 Maximum value: 100000.0
Example:
[77: 32, 18.01: 10.87]
Declaration
Swift
public func with(constantSpeedConsumptionInkWhPerHundredkm: [Float : Float]) -> Self
-
Sets weight of the vehicle in kilograms.
- If a detailed consumption model is specified, refer to the consumption model parameters section for information in vehicleWeight.
- If no detailed consumption model is specified, and the value of vehicleWeight is non-zero, then weight restrictions are considered.
In all other cases, this parameter is ignored.
Declaration
Swift
public func with(vehicleWeight: Measurement<UnitMass>) -> Self
-
Specifies the efficiency of converting chemical energy stored in fuel to kinetic energy when the vehicle accelerates, (i.e., KineticEnergyGained/ChemicalEnergyConsumed).
- ChemicalEnergyConsumed is obtained by converting consumed fuel to chemical energy using fuelEnergyDensityInMJoulesPerLiter.
Note
This must be paired with decelerationEfficiency.Minimum value: 0.0
Maximum value: 1/decelerationEfficiency
Declaration
Swift
public func with(accelerationEfficiency: Float) -> Self
-
Specifies the efficiency of converting kinetic energy to saved (not consumed) fuel when the vehicle decelerates (i.e., ChemicalEnergySaved/KineticEnergyLost).
- ChemicalEnergySaved is obtained by converting saved (not consumed) fuel to energy using fuelEnergyDensityInMJoulesPerLiter.
Note
This must be paired with accelerationEfficiency.Minimum value: 0.0
Maximum value: 1/accelerationEfficiency
Declaration
Swift
public func with(decelerationEfficiency: Float) -> Self
-
Specifies the efficiency of converting chemical energy stored in fuel to potential energy when the vehicle gains elevation, (i.e. PotentialEnergyGained/ChemicalEnergyConsumed).
- ChemicalEnergyConsumed is obtained by converting consumed fuel to chemical energy using fuelEnergyDensityInMJoulesPerLiter.
Note
This must be paired with downhillEfficiency.Minimum value: 0.0
Maximum value: 1/downhillEfficiency
Declaration
Swift
public func with(uphillEfficiency: Float) -> Self
-
Specifies the efficiency of converting potential energy to saved (not consumed) fuel when the vehicle loses elevation, (i.e., ChemicalEnergySaved/PotentialEnergyLost).
- ChemicalEnergySaved is obtained by converting saved (not consumed) fuel to energy using fuelEnergyDensityInMJoulesPerLiter.
Note
This must be paired with uphillEfficiency.Minimum value: 0.0
Maximum value: 1/uphillEfficiency
Declaration
Swift
public func with(downhillEfficiency: Float) -> Self
-
Sets the amount of electric energy currently in the vehicle battery, expressed in kilowatt hours (kWh).
Declaration
Swift
public func with(currentChargeInkWh: Float) -> Self
-
Sets the maximum amount of electric energy that the vehicle battery can hold, expressed in kilowatt hours (kWh).
Declaration
Swift
public func with(maxChargeInkWh: Float) -> Self
-
Sets the vehicle engine type.
Declaration
Swift
public func with(vehicleEngineType: EngineType) -> Self
-
Sets the section types.
Declaration
Swift
public func with(sectionTypes: [SectionType]) -> Self
-
Sets the custom endpoint for requests
Declaration
Swift
public func with(customEndpoint: String) -> Self
-
Sets the type of guidance instructions to include in the response.
Declaration
Swift
public func with(instructionsType: InstructionsType) -> Self
-
Sets the language.
Declaration
Swift
public func with(language: String) -> Self
-
Sets the vehicle heading.
Declaration
Swift
public func with(vehicleHeading: NSNumber) -> Self
-
Sets the type of the route.
Declaration
Swift
public func with(routeType: RouteType) -> Self
-
Sets the route travel mode.
Declaration
Swift
public func with(travelMode: TravelMode) -> Self
-
Creates waypoint with given coordinates and appends it to itinerary.waypoints array.
Declaration
Swift
public func with(waypointCoordinate: CLLocationCoordinate2D) -> Self
-
Creates an array of waypoints with given array of coordinates and assigns it to itinerary.waypoints array.
Declaration
Swift
public func with(waypointCoordinates: [CLLocationCoordinate2D]) -> Self
-
Appends new waypoint to the itinerary.waypoints array.
Declaration
Swift
public func with(waypoint: ItineraryPoint) -> Self
-
Sets the array of waypoints to itinerary.waypoints.
Declaration
Swift
public func with(waypoints: [ItineraryPoint]) -> Self
-
Sets a new arrival date.
Declaration
Swift
public func with(arriveAt: Date) -> Self
-
Sets the number of alternative routes to be calculated. The value provided:
- Must be an integer in the range 0-5.
- Fewer alternative routes may be returned if either fewer alternatives exist, or the requested number of alternatives is larger than the service can calculate. Default value: 0 Maximum value: 5
Declaration
Swift
public func with(maxAlternatives: NSInteger) -> Self
-
Sets the speed-dependent component of consumption. Provided as an unordered list of speed/consumption-rate pairs. The list defines points on a consumption curve.
Consumption rates for speeds not in the list are found as follows:
- If the speed is between two speeds on the list, the rate is calculated by linear interpolation of those two points.
- If the speed is not in the range of the list, the rate is calculated by linear extrapolation, assuming a constant (&ΔConsumption/&ΔSpeed) determined by the nearest two points in the list.
The list must contain between 1 and 25 points (inclusive), and may not contain duplicate points for the same speed. If it only contains a single point, then the consumption rate of that point is used without further processing.
The consumption specified for the largest speed must be greater than or equal to that of the next highest speed. This ensures that extrapolation does not lead to negative consumption rates.
Similarly, consumption values specified for the two smallest speeds in the list cannot lead to a negative consumption rate for any smaller speed.
The minimum and maximum values described here refer to the valid range for the consumption values (expressed in l/100km).
- Minimum value: 0.01
- Maximum value: 100000.0
Example:
let constantSpeedConsumptionInLitersPerHundredkm: [Float: Float] = [ 10: 6.5, 30: 7.5, 50: 8, 70: 8.4, 90: 7.7, 120: 7.5, 150: 9 ]
Declaration
Swift
public func with(constantSpeedConsumptionInLitersPerHundredkm: [Float : Float]) -> Self
- If the speed is between two speeds on the list, the rate is calculated by linear interpolation of those two points.
-
Sets the current supply of fuel in liters.
Declaration
Swift
public func with(currentFuelInLiters: NSNumber) -> Self
-
Sets the amount of fuel consumed by the vehicle’s auxiliary systems, in liters per hour.
- This can be used to specify consumption due to devices and systems such as AC systems, radio, heating, etc.
Declaration
Swift
public func with(auxiliaryPowerInLitersPerHour: NSNumber) -> Self
-
Specifies the amount of chemical energy stored in one liter of fuel, expressed in megajoules (MJ).
- Used in conjunction with any of the efficiency parameters for conversions between saved or consumed energy and fuel.
- For example, energy density is 34.2 MJ/l for gasoline, and 35.8 MJ/l for Diesel fuel.
- This parameter must be used/required if any of the efficiency parameters are set.
Declaration
Swift
public func with(fuelEnergyDensityInMJoulesPerLiter: NSNumber) -> Self
-
When maxAlternatives is greater than 0, specifies the objective of computing alternative routes: finding routes that are significantly different than the reference route, or finding routes that are better than the reference route. Possible values are:
anyRoute: Return alternative routes that are significantly different from the reference route.
betterRoute: Return only alternative routes that are better than the reference route, according to the planning criteria set by routeType. If there is a road block on the reference route, then any alternative that does not contain blockages will be considered a better route.
Note: This optional parameter can only be used when reconstructing a route.
Default value: anyRoute
Other values: betterRoute
Declaration
Swift
public func with(alternativeType: AlternativeType) -> Self
-
Sets a list of base route points defined as
CLLocationCoordinate2D
, to be used as input for route reconstruction.Declaration
Swift
public func with(supportingPoints: SupportingPoints) -> Self
-
Sets the minimum deviation distance in metters.
All alternative routes returned must follow the reference route for at least this distance from the origin point of the calculateRoute request.
- Can only be used when reconstructing a route.
- The minDeviationDistance parameter cannot be used in conjunction with arriveAt.
Declaration
Swift
public func with(minDeviationDistance: Int) -> Self
-
Sets the minimum deviation time in secods.
All alternative routes returned will follow the reference route (see the POST Requests section) from the origin point of the calculateRoute request for at least this number of seconds.
- Can only be used when reconstructing a route.
- The minDeviationTime parameter cannot be used in conjunction with arriveAt.
Declaration
Swift
public func with(minDeviationTime: Int) -> Self
-
Appends the vignette code to avoid.
Declaration
Swift
public func with(avoidVignette: String) -> Self
-
Sets the avoid vignettes array.
This is a list of 3-character, ISO 3166-1, alpha-3 country codes of countries in which all toll roads with vignettes are to be avoided. Toll roads with vignettes in countries not in the list are unaffected.
Declaration
Swift
public func with(avoidVignettes: [String]) -> Self
-
Sets the list of shapes to avoid for planning routes.
Declaration
Swift
public func with(avoidArea: [LatLngBounds]) -> Self
-
Sets whether the report should be provided.
Declaration
Swift
public func with(reportType: ReportType) -> Self
-
Sets whether the traffic information will be considered.
Declaration
Swift
public func with(considerTraffic: Bool) -> Self
-
Sets the degree of hilliness for a thrilling route. Note: This parameter can only be used in conjunction with routeType=thrilling.
Declaration
Swift
public func with(hilliness: Hilliness) -> Self
-
Sets the level of turns for thrilling route. Note: This parameter can only be used in conjunction with routeType=thrilling.
Declaration
Swift
public func with(windingness: Windingness) -> Self
-
Set additional data.
Declaration
Swift
public func with(extras: [String : String?]) -> Self
-
Specifies the electric energy in kWh consumed by the vehicle when it gains 1000 meters of elevation.
Note
This must be paired with recuperationInkWhPerkmAltitudeLoss.Note
This cannot be used with accelerationEfficiency, decelerationEfficiency, uphillEfficiency or downhillEfficiency.Minimum value: recuperationInkWhPerkmAltitudeLoss
Maximum value: 500.0
Declaration
Swift
public func with(consumptionInkWhPerkmAltitudeGain: Float) -> Self
-
Sets the electric energy in kWh gained by the vehicle when it loses 1000 meters of elevation.
Note
This must be paired with consumptionInkWhPerkmAltitudeGain.
Note
This cannot be used with accelerationEfficiency, decelerationEfficiency, uphillEfficiency or downhillEfficiency.
Minimum value: 0.0
Maximum value: consumptionInkWhPerkmAltitudeGain
Declaration
Swift
public func with(recuperationInkWhPerkmAltitudeLoss: Float) -> Self
-
Specifies an identifier for the request. The value should be unique for each request. The value must match the regular expression ‘^[a-zA-Z0-9-]{1,100}$’.
Declaration
Swift
public func with(trackingId: String) -> Self
-
Specifies that lane sections should be included in the routing response.
Declaration
Swift
public func includeLaneInformation() -> Self
-
Specifies that speed limits should be included in the routing response.
Declaration
Swift
public func includeSpeedLimits() -> Self
-
Specifies that road shields should be included in the response.
Declaration
Swift
public func includeRoadShieldsInformation() -> Self
-
Specifies whether to include road shield references into the external road shields atlas.
Declaration
Swift
public func with(instructionRoadShieldReferences: RequestedRoadShieldReferences) -> Self
-
Specifies whether to include announcement points in instructions. If specified, the instruction will include up to three additional fine-grained announcement points, each with its own location, maneuver type, and distance to the instruction point.
Declaration
Swift
public func with(instructionAnnouncementPoints: AnnouncementPoints) -> Self
-
Specifies whether to include the phonetic transcription of street names, signpost text, and road numbers in the instructions.
Declaration
Swift
public func with(instructionPhonetics: InstructionPhoneticsType) -> Self