Home > @magiclane/maps-sdk > RoutePreferences
RoutePreferences class
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: - for cars, including fuel type and vehicle mass - for trucks, with dimensions and axle load constraints - for bicycles, supporting both standard and electric bikes - for walking or wheelchair-accessible routes
Common preferences include (fastest, shortest, economic), , , , , and strategies. Public transport options include departure/arrival times via and , transfer constraints, and sorting strategies. Emergency vehicle mode relaxes routing constraints.
Routing
Signature:
export declare class RoutePreferences extends GemAutoreleaseObject Extends: GemAutoreleaseObject
Constructors
|
Constructor |
Modifiers |
Description |
|---|---|---|
|
Creates a new set of routing preferences used to customize how routes are calculated. Can be called in two ways for backward compatibility: - |
Properties
|
Property |
Modifiers |
Type |
Description |
|---|---|---|---|
|
boolean |
Enables accurate track matching for route-over-track computations. When true, the SDK uses more precise track matching algorithms during route calculation when track-based landmarks are provided. Default is | ||
|
boolean |
Get accurate waypoints approach. An accurate approach implies that the route arrives at the waypoint on the drive side of the region. Default is | ||
|
Public transport algorithm type for determining departure or arrival time optimization. Default is | |||
|
boolean |
Allows route calculation using online services when available. Default is | ||
|
boolean |
Enables balanced sorting for alternative route results. Default is | ||
|
Schema defining how alternative routes are generated and returned. Default is | |||
|
number |
Hill avoidance factor for bicycle routes, ranging from 0.0 to 1.0. | ||
|
boolean |
Avoids carpool/HOV lanes when calculating routes. Default is | ||
|
boolean |
Avoids ferry crossings when calculating routes. Default is | ||
|
string[] |
Get the geofence anti-area avoidance IDs list An anti-area geofence is an area within which boundaries the route should remain during calculation. If is true and the route cannot stay in the requested boundaries, routing will fail. | ||
|
string[] |
Get the geofence area avoidance IDs list | ||
|
boolean |
Avoids motorways/highways when calculating routes. Default is | ||
|
boolean |
Avoids toll roads when calculating routes. Default is | ||
|
Traffic avoidance strategy for route calculation. Default is | |||
|
boolean |
Avoids generating "Turnaround when possible" instructions during navigation. Default is | ||
|
boolean |
Avoids unpaved roads when calculating routes. Default is | ||
|
Bicycle routing profile for standard and electric bikes. Default is | |||
|
boolean |
Enables building route segment connections metadata. Default is | ||
|
|
number |
Get route connections build max length. Default is -1 | |
|
Controls whether terrain profile data is generated for the route. Default terrain profile disabled. | |||
|
Car routing profile with vehicle-specific constraints. Default is | |||
|
|
Default electric bike profile configuration. | ||
|
Departure heading and accuracy for route calculation. Default heading and accuracy are -1 (no constraint). | |||
|
number |
Extra freedom levels for emergency vehicle routing constraints. Only applies when is true. Default is | ||
|
boolean |
Enables emergency vehicle routing mode with relaxed constraints. Default is | ||
|
number |
Bike & pedestrian routing fitness factor, ranging from 0.0 to 1.0. Default is | ||
|
boolean |
Ignores map restrictions during route-over-track calculations. Default is | ||
|
boolean |
Get the immutable roadblock avoidance state. If set, the algorithm rather fails than routing through roadblocks. Default is | ||
|
boolean |
Track resume mode for path-based routing with track landmarks. Default is | ||
|
boolean |
Enables maximum distance constraints based on transport mode. Default is | ||
|
number |
Maximum transfer time between public transport connections, in minutes. Default is | ||
|
number |
Maximum walking distance for public transport routes, in meters. Default is | ||
|
number |
Minimum transfer time between public transport connections, in minutes. Default is | ||
|
Path calculation algorithm to use for routing. Default is | |||
|
Flavor variant of the selected path algorithm. Default is | |||
|
Pedestrian routing profile for walking and wheelchair accessibility. Default is | |||
|
|
any | ||
|
Level of detail to include in route calculation results. Default is | |||
|
Set parameters for roundtrip feature. | |||
|
|
number |
Get roundtrip random seed. | |
|
|
number |
Get roundtrip range. | |
|
|
Get roundtrip range type. | ||
|
number[] |
Route group IDs for earlier/later trip calculations in public transport. Default is an empty list | ||
|
number[] |
Route range values for isoline/isochrone calculations. Default is an empty list (no range calculation) | ||
|
number |
Quality level for route range calculations, from 0 to 100. Default is | ||
|
|
Route result type indicating the format of the returned route. Default is | ||
|
Primary route optimization criterion. Default is | |||
|
Set<RouteTypePreferences> |
Additional route type preference flags. Default is | ||
|
Public transport route sorting strategy. Default is | |||
|
Date | null |
Local departure or arrival time for public transport routing. Default is | ||
|
Primary transport mode for route calculation. Default is | |||
|
Truck routing profile with vehicle-specific constraints. Default is | |||
|
boolean |
Ensures bike accessibility for public transport routes. Default is | ||
|
boolean |
Ensures wheelchair accessibility for public transport routes. Default is | ||
|
|
VehicleRegistration | null |
Returns the vehicle registration profile for the current transport mode. Extracts the relevant vehicle profile (CarProfile, TruckProfile, or ElectricBikeProfile) based on the selected . Returns null for pedestrian, public, and shared vehicle modes or when no profile is configured. |
Methods
|
Method |
Modifiers |
Description |
|---|---|---|
|
|
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. | |