RoutePreferences constructor
RoutePreferences({
- bool accurateTrackMatch = true,
- PTAlgorithmType algorithmType = PTAlgorithmType.departure,
- bool allowOnlineCalculation = true,
- bool alternativeRoutesBalancedSorting = true,
- RouteAlternativesSchema alternativesSchema = RouteAlternativesSchema.defaultSchema,
- double avoidBikingHillFactor = 0.5,
- bool avoidCarpoolLanes = false,
- bool avoidFerries = false,
- bool avoidMotorways = false,
- bool avoidTollRoads = false,
- TrafficAvoidance avoidTraffic = TrafficAvoidance.none,
- bool avoidTurnAroundInstruction = false,
- bool avoidUnpavedRoads = false,
- BikeProfileElectricBikeProfile? bikeProfile,
- bool buildConnections = false,
- BuildTerrainProfile buildTerrainProfile = const BuildTerrainProfile(),
- CarProfile? carProfile,
- DepartureHeading departureHeading = const DepartureHeading(),
- int emergencyVehicleExtraFreedomLevels = 0,
- bool emergencyVehicleMode = false,
- bool ignoreRestrictionsOverTrack = false,
- bool maximumDistanceConstraint = true,
- int maximumTransferTimeInMinutes = 300,
- int maximumWalkDistance = 5000,
- int minimumTransferTimeInMinutes = 1,
- RoutePathAlgorithm pathAlgorithm = RoutePathAlgorithm.ml,
- RoutePathAlgorithmFlavor pathAlgorithmFlavor = RoutePathAlgorithmFlavor.magicLane,
- PedestrianProfile pedestrianProfile = PedestrianProfile.walk,
- RouteResultDetails resultDetails = RouteResultDetails.full,
- List<
int> routeGroupIdsEarlierLater = const <int>[], - List<
int> routeRanges = const <int>[], - int routeRangesQuality = 100,
- RouteResultType routeResultType = RouteResultType.path,
- RouteType routeType = RouteType.fastest,
- Set<
RouteTypePreferences> routeTypePreferences = const <RouteTypePreferences>{RouteTypePreferences.none}, - PTSortingStrategy sortingStrategy = PTSortingStrategy.bestTime,
- DateTime? timestamp,
- RouteTransportMode transportMode = RouteTransportMode.car,
- TruckProfile? truckProfile,
- bool useBikes = false,
- bool useWheelchair = false,
- bool isTrackResume = true,
- RoundTripParameters? roundTripParameters,
- int? roundTripRange,
- RangeType roundTripRangeType = RangeType.defaultType,
- int? roundTripRandomSeed,
Creates a new set of routing preferences used to customize how routes are calculated.
These preferences control routing behavior such as transport mode, avoidance options, algorithm selection, profile overrides, and constraints for transfers, walking distance, and timing. Provide only the options you need; unspecified profile fields will fall back to default behavior. This constructor configures a request-level set of hints that influence route generation and result formatting.
Parameters
accurateTrackMatch: When true, prefer tighter matching of the computed route to an existing track or path to increase positional accuracy.algorithmType: Public-transport algorithm selection. Specifies if thetimestampshould be interpreted for departure or arrival-based strategies.allowOnlineCalculation: Whether online calculation can be used. Iffalse, the routing engine will rely solely on offline data.alternativeRoutesBalancedSorting: Balances sorting of alternative routes.alternativesSchema: Defines the schema for alternative routes.avoidBikingHillFactor: Factor that influences how strongly hills are avoided when computing bike routes; larger values increase avoidance.avoidCarpoolLanes: When true, avoid carpool/HOV lanes in car routing.avoidFerries: When true, avoid ferry segments in the route.avoidMotorways: When true, avoid motorways/highways when possible.avoidTollRoads: When true, avoid toll roads when possible.avoidTraffic: Level of traffic avoidance to apply when computing motorized routes.avoidTurnAroundInstruction: When true, prefer routes that do not require explicit turn-around maneuvers.avoidUnpavedRoads: When true, avoid unpaved or unsealed roads in the route.bikeProfile: Optional bike-specific routing profile to override default bicycle behavior.buildConnections: When true, construct and include connections.buildTerrainProfile: Options controlling whether and how a terrain profile is built for the route. Is crucial for RouteTerrainProfile availability.carProfile: Optional car-specific routing profile to override default car behavior.departureHeading: Optional heading constraint applied at the route origin.emergencyVehicleExtraFreedomLevels: Extra freedom levels for emergency vehicles.emergencyVehicleMode: When true, enable emergency-vehicle routing behavior and allowances.ignoreRestrictionsOverTrack: When true, ignore map-based restrictions during path based calculations.maximumDistanceConstraint: When true, enforce maximum distance constraints where applicable.maximumTransferTimeInMinutes: Maximum allowed transfer time (in minutes) when building transit routes.maximumWalkDistance: Maximum walking distance (in meters) that is allowed in the public transport route.minimumTransferTimeInMinutes: Minimum allowed transfer time (in minutes) between connections in public transport routes.pathAlgorithm: Choice of pathfinding algorithm used to compute the route geometry.pathAlgorithmFlavor: Variant or flavor of the chosen path algorithm to tweak behavior or heuristics.pedestrianProfile: Pedestrian profile selection (for example, walk, run) to influence pedestrian routing.resultDetails: Level of detail to include in the returned Route (summary vs full details).routeGroupIdsEarlierLater: IDs for earlier/later route groups.routeRanges: List of route ranges thresholds used when generating route ranges. The unit depends on therouteType.routeRangesQuality: Quality threshold applied to route ranges.routeResultType: The type of the returned Route type: navigable path or range.routeType: Preferred route type (for example, fastest, shortest, or eco).routeTypePreferences: Set of additional public-transport route type preferences influencing the preferred transport modes.sortingStrategy: Strategy used to sort or rank public-transport alternatives.timestamp: Optional reference timestamp for the routing request (e.g., departure/arrival time).transportMode: Primary transport mode for the route (for example, car, bike, pedestrian).truckProfile: Optional truck-specific routing profile to override default truck behavior.useBikes: When true, enable bike-accessible routing constraints.useWheelchair: When true, enable wheelchair-accessible routing constraints.isTrackResume: Whether path-based routing should follow the whole track or resume from the closest point.roundTripParameters: Optional parameters for roundtrip route generation.roundTripRange: Desired roundtrip distance or duration, depending onroundTripRangeType.roundTripRangeType: Unit type for the roundtrip range (distance or duration).roundTripRandomSeed: Optional random seed to influence roundtrip route generation variability.
See also:
- RoutePreferences - The class holding these constructor options.
- RouteTransportMode - Available transport modes that affect routing behavior.
- CarProfile - Car-specific routing constraints.
- TruckProfile - Truck-specific routing constraints.
Implementation
RoutePreferences({
this.accurateTrackMatch = true,
this.algorithmType = PTAlgorithmType.departure,
this.allowOnlineCalculation = true,
this.alternativeRoutesBalancedSorting = true,
this.alternativesSchema = RouteAlternativesSchema.defaultSchema,
this.avoidBikingHillFactor = 0.5,
this.avoidCarpoolLanes = false,
this.avoidFerries = false,
this.avoidMotorways = false,
this.avoidTollRoads = false,
this.avoidTraffic = TrafficAvoidance.none,
this.avoidTurnAroundInstruction = false,
this.avoidUnpavedRoads = false,
this.bikeProfile,
this.buildConnections = false,
this.buildTerrainProfile = const BuildTerrainProfile(),
this.carProfile,
this.departureHeading = const DepartureHeading(),
this.emergencyVehicleExtraFreedomLevels = 0,
this.emergencyVehicleMode = false,
this.ignoreRestrictionsOverTrack = false,
this.maximumDistanceConstraint = true,
this.maximumTransferTimeInMinutes = 300,
this.maximumWalkDistance = 5000,
this.minimumTransferTimeInMinutes = 1,
this.pathAlgorithm = RoutePathAlgorithm.ml,
this.pathAlgorithmFlavor = RoutePathAlgorithmFlavor.magicLane,
this.pedestrianProfile = PedestrianProfile.walk,
this.resultDetails = RouteResultDetails.full,
this.routeGroupIdsEarlierLater = const <int>[],
this.routeRanges = const <int>[],
this.routeRangesQuality = 100,
this.routeResultType = RouteResultType.path,
this.routeType = RouteType.fastest,
this.routeTypePreferences = const <RouteTypePreferences>{
RouteTypePreferences.none,
},
this.sortingStrategy = PTSortingStrategy.bestTime,
this.timestamp,
this.transportMode = RouteTransportMode.car,
this.truckProfile,
this.useBikes = false,
this.useWheelchair = false,
this.isTrackResume = true,
this.roundTripParameters,
this.roundTripRange,
this.roundTripRangeType = RangeType.defaultType,
this.roundTripRandomSeed,
});