Version:
Popular examples
Map
Geo objects
Balloon and hint
Controls
Hotspots
Regions
Clustering
GeoQuery
Behaviors and events
Search on a map
Traffic
User's location
Routing
YMapsML
GeoXML
ObjectManager
Modular system
Panoramas
External modules

Building a driving multiroute

Save as filesEdit on JSFiddle

The multirouter allows planning multiple routes at once using the set points.

The multiRouter.MultiRoute class is used for creating a multiroute. The following objects are passed as its parameters:

  • The multiroute model. It is defined as an object with fields:
    • referencePoints - Array of reference points for the route. Note that if more than two reference points are set, the router only returns one route.
    • params - Routing parameters (for example, the type of routing, consider traffic, and so on).
  • router options. The options specify rules for displaying routes on the map.

All anchor points on the route are divided into waypoints (wayPoint) and throughpoints (viaPoint). Waypoints are points at which you must stop, and throughpoints are passed through on the route without stopping.

After all the routes are built, the shortest one is activated automatically. This route is shown in purple on the map. Gray dotted lines denote transfers from one type of transport to another, or crossing from one station to another (for public transport routes).
Inactive routes are shown in gray. To switch the active route, just right-click the desired route. The active route can also be switched programmatically. See multiRouter.MultiRouteModel#methods-summary.