RoutePreferences class Routing

Comprehensive route calculation configuration for customizing routing behavior.

RoutePreferences centralizes all route calculation options including transport mode, vehicle profiles, avoidance settings (motorways, tolls, ferries, unpaved roads), traffic handling, algorithm selection, result detail levels, and alternative route handling. Set preferences before calling RoutingService.calculateRoute to control how routes are computed.

Each transport mode supports specific profile configurations:

  • carProfile for cars, including fuel type and vehicle mass
  • truckProfile for trucks, with dimensions and axle load constraints
  • bikeProfile for bicycles, supporting both standard and electric bikes
  • pedestrianProfile for walking or wheelchair-accessible routes

Common preferences include routeType (fastest, shortest, economic), avoidMotorways, avoidTollRoads, avoidFerries, avoidUnpavedRoads, and avoidTraffic strategies. Public transport options include departure/arrival times via timestamp and algorithmType, transfer constraints, and sorting strategies. Emergency vehicle mode relaxes routing constraints.

See also:

Constructors

RoutePreferences({bool accurateTrackMatch = true, PTAlgorithmType algorithmType = PTAlgorithmType.departure, bool allowOnlineCalculation = true, bool alternativeRoutesBalancedSorting = true, RouteAlternativesSchema alternativesSchema = RouteAlternativesSchema.defaultSchema, @Deprecated('Use fitnessFactor instead') double? avoidBikingHillFactor, double fitnessFactor = 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, 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, bool immutableRoadblockAvoidance = false, bool accurateWaypointsApproach = false, RoundTripParameters? roundTripParameters})
Creates a new set of routing preferences used to customize how routes are calculated.
factory

Properties

accurateTrackMatch bool
Enables accurate track matching for route-over-track computations.
getter/setter pair
accurateWaypointsApproach bool
Get accurate waypoints approach. An accurate approach implies that the route arrives at the waypoint on the drive side of the region.
getter/setter pair
algorithmType PTAlgorithmType
Public transport algorithm type for determining departure or arrival time optimization.
getter/setter pair
allowOnlineCalculation bool
Allows route calculation using online services when available.
getter/setter pair
alternativeRoutesBalancedSorting bool
Enables balanced sorting for alternative route results.
getter/setter pair
alternativesSchema RouteAlternativesSchema
Schema defining how alternative routes are generated and returned.
getter/setter pair
avoidBikingHillFactor double
Hill avoidance factor for bicycle routes, ranging from 0.0 to 1.0.
getter/setter pair
avoidCarpoolLanes bool
Avoids carpool/HOV lanes when calculating routes.
getter/setter pair
avoidFerries bool
Avoids ferry crossings when calculating routes.
getter/setter pair
avoidGeofenceAntiAreas List<String>
Get the geofence anti area avoidance ids list An anti area geofence is an area in which boundaries the route should remain during the calculation. If immutableRoadblockAvoidance == true and the route cannot stay in the requested boundaries, the routing will fail with GemError.noRoute Send an empty list to disable geofence anti area avoidance
getter/setter pair
avoidGeofenceAreas List<String>
Get the geofence area avoidance ids list
getter/setter pair
avoidMotorways bool
Avoids motorways/highways when calculating routes.
getter/setter pair
avoidTollRoads bool
Avoids toll roads when calculating routes.
getter/setter pair
avoidTraffic TrafficAvoidance
Traffic avoidance strategy for route calculation.
getter/setter pair
avoidTurnAroundInstruction bool
Avoids generating "Turnaround when possible" instructions during navigation.
getter/setter pair
avoidUnpavedRoads bool
Avoids unpaved roads when calculating routes.
getter/setter pair
bikeProfile BikeProfileElectricBikeProfile
Bicycle routing profile for standard and electric bikes.
getter/setter pair
buildConnections bool
Enables building route segment connections metadata.
getter/setter pair
buildConnectionsMaxLength int
Get route connections build max length.
no setter
buildTerrainProfile BuildTerrainProfile
Controls whether terrain profile data is generated for the route.
getter/setter pair
carProfile CarProfile
Car routing profile with vehicle-specific constraints.
getter/setter pair
defaultEBikeProfile ElectricBikeProfile
Default electric bike profile configuration.
no setter
departureHeading DepartureHeading
Departure heading and accuracy for route calculation.
getter/setter pair
emergencyVehicleExtraFreedomLevels int
Extra freedom levels for emergency vehicle routing constraints in a packed integer format.
getter/setter pair
emergencyVehicleMode bool
Enables emergency vehicle routing mode with relaxed constraints.
getter/setter pair
fitnessFactor double
Bike & pedestrian routing fitness factor, ranging from 0.0 to 1.0.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
hasRegisteredAutoReleaseObject bool
getter/setter pairinherited
ignoreRestrictionsOverTrack bool
Ignores map restrictions during route-over-track calculations.
getter/setter pair
immutableRoadblockAvoidance bool
Get the immutable roadblock avoidance state If set, the algorithm rather fails than routing through roadblocks.
getter/setter pair
isTrackResume bool
Track resume mode for path-based routing with track landmarks.
getter/setter pair
maximumDistanceConstraint bool
Enables maximum distance constraints based on transport mode.
getter/setter pair
maximumTransferTimeInMinutes int
Maximum transfer time between public transport connections, in minutes.
getter/setter pair
maximumWalkDistance int
Maximum walking distance for public transport routes, in meters.
getter/setter pair
minimumTransferTimeInMinutes int
Minimum transfer time between public transport connections, in minutes.
getter/setter pair
pathAlgorithm RoutePathAlgorithm
Path calculation algorithm to use for routing.
getter/setter pair
pathAlgorithmFlavor RoutePathAlgorithmFlavor
Flavor variant of the selected path algorithm.
getter/setter pair
pedestrianProfile PedestrianProfile
Pedestrian routing profile for walking and wheelchair accessibility.
getter/setter pair
pointerId int
The pointer ID of the native object
no setterinherited
resultDetails RouteResultDetails
Level of detail to include in route calculation results.
getter/setter pair
roundTripParameters RoundTripParameters
Set parameters for roundtrip feature.
no getter
roundTripRandomSeed int
Get roundtrip random seed.
no setter
roundTripRange int
Get roundtrip range (see roundTripParameters for explanation of how the units work).
no setter
roundTripRangeType RangeType
Get roundtrip range type.
no setter
routeGroupIdsEarlierLater List<int>
Route group IDs for earlier/later trip calculations in public transport.
getter/setter pair
routeRanges List<int>
Route range values for isoline/isochrone calculations.
getter/setter pair
routeRangesQuality int
Quality level for route range calculations, from 0 to 100.
getter/setter pair
routeResultType RouteResultType
Route result type indicating the format of the returned route.
no setter
routeType RouteType
Primary route optimization criterion.
getter/setter pair
routeTypePreferences Set<RouteTypePreferences>
Additional route type preference flags.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sortingStrategy PTSortingStrategy
Public transport route sorting strategy.
getter/setter pair
timestamp DateTime?
Local departure or arrival time for public transport routing.
getter/setter pair
transportMode RouteTransportMode
Primary transport mode for route calculation.
getter/setter pair
truckProfile TruckProfile
Truck routing profile with vehicle-specific constraints.
getter/setter pair
useBikes bool
Ensures bike accessibility for public transport routes.
getter/setter pair
useWheelchair bool
Ensures wheelchair accessibility for public transport routes.
getter/setter pair
vehicleRegistration VehicleRegistration?
Returns the vehicle registration profile for the current transport mode.
no setter

Methods

dispose() → void
Disposes the native object.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerAutoReleaseObject(int pointerId) → void
Registers an object for auto release.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited