Route Provider element enables to define an alternative road network in GIS model plus to the default one defined by the GIS map.
In GIS models agents move following the existing roads. However, different types of agents use different types of roads: trains move along railways, cars follow autoroutes, and so on. That is why AnyLogic enables users to obtain data on roads of different types and make agents use this or that specific road network.
AnyLogic supports four types of road networks: Car (for all types of vehicles), Rail, Bike, and Foot.
If all moving agents in your GIS model belong to one category (e.g., vehicles), you just specify the required Road type: Car in the Routing section of the GIS map properties.
But if you have several types of agents that use different types of roads, you need to add Route provider element in your model to enable some agents to use not the default road network of the GIS map, but some alternative road network.
The model below demonstrates how to do this. It contains two
types of transport: trains and cars. On clicking a button in the
model, you start movement of an agent (either a car, or a train) from Paris to Nice. If you send
both of them, you will see that cars and trains use different routes to
reach the same destination. Cars use the default road network provided
by the GIS map (Road type: Car), while trains use the custom route provider with the Road type: Rail.
Sample model: Route Provider
Name – The name of the route provider. The name is used to refer to the provider from agent population properties, etc.
Ignore – If selected, the route provider is excluded from the model.
Visible on upper level – If selected, the route provider icon is also visible on the upper level where this agent lives.
Visible – Here you specify whether the route provider icon is visible on animation at model runtime, or not. Using the control, choose yes or no.
Routes are – Here you can choose how this route provider obtains the data on the route network. You can choose the routes to be Requested from OSM server (then you can choose the routing server), or use the option Loaded from PBF file to create a routing graph from a file on your hard drive. If you select the Straight lines option, the routes will be just drawn as straight lines on the GIS map.
Routing server – [Available if the Routes are requested from OSM server] There are three routing servers available: AnyLogic (recommended) YOURS and BRouter.
Routing method – [N/A if the Routes are: Straight lines] Choose here, if you want agents to take Shortest or Fastest routes in the network.
Road type – [N/A if the Routes are: Straight lines] Choose here the road network type: Road, Rail, Bike, or Foot.
Pathfinding algorithm – [Available if Routes are loaded from PBF file] Choose the pathfinding algorithm: A*, bidirectional A*, Dijkstra, Dijkstra bidirectional, Dijkstra native bidirectional.
Specify routing graph – [Available if Routes are loaded from PBF file] Click this button to open the routing graph wizard where you can create a new graph or select to use an existing one. The supported file types are .pbf and .osm.
If route not found – Here you indicate what you want AnyLogic to do if a route cannot be created (typically because the route does not exist). If you want AnyLogic to approximate a route with a straight line and continue running the model, select the option Create straight route. If you want AnyLogic to notify you about such a problem and stop, choose Show error dialog.
Show name – If selected, the name of the route provider will be shown in the graphical editor close to the element icon.
Use custom route provider – If you want to use a custom online route service, click here and an edit box labeled Custom route provider will appear. In this box, AnyLogic has provided sample code with comments.