Route with alternatives
Display route alternatives and what sets each one apart
Each card says what sets its route apart: how far it drives alone, its main roads and what it adds or avoids against the selected route or the usual one.
maxAlternativesgets the alternatives in one request, each with itssections.distinct, so the distance takes no geometry work.getImportantRoadsnames the roads within those sections, each once.compareRouteslists the ferries, tolls, jams and closures one route takes and the other doesn’t, the usual route asking forcostModel: { traffic: 'historical' }.setSectionFocusrings a route’s own roads, or what a chip names, as you point at it.
Related examples
Add Stops to Route (Playground)
Dynamically add and remove intermediate stops on a route by clicking the map
Playground
Routing
Utilities
User Interaction Events
Web
Add Stops to Route
Find stops along a route within a one-minute detour and insert them all at optimal positions in a single call.
Getting Started
Routing
Search and Geocoding
Electric Vehicles
Utilities
Web
Display units
Switch a route's labels and your own text between metric, imperial UK and imperial US units.
Getting Started
Utilities
Routing
Web
Map reachable ranges from multiple locations
Calculate time-based accessibility areas from multiple locations
Getting Started
Routing
User Interaction Events
Web