# Using Network Analyst to retrieve the shortest bus route with many lines

I am trying to use the Network Analyst to find the "best" route from A to B using the bus line. I have just a sample of the whole line, but my main concern at the moment is to find the best (in terms of time AND length) route such that I don't need to switch bus line.

For example (see figure below): to go from A to B I can use bus lines 1, 2, and 3, taking 10 minutes and 5 km. But I would likely waste time in changing from bus line 1 to 2 and again 3 (my 10 minutes would double!). Let's say bus line 4 is also close to my point A. I'd prefer to take bus line 4, which takes 15 minutes and 7 km, but I don't have to change any bus. This would be my "best route".

The "switching bus line" would become a variable contributing to change the "cost" of the route (as time and length). Is there a way I can retrieve my best route in such a way? Of course other variables will be as important for determining the best route, but at present this is the problem I would like to solve (hopefully).

• Your routes would have to be broken into individual segments if they aren't already. Each segment needs its own cost attribute. To address changing bus lines you could introduce a node cost through turns, however it would probably take some detailed modeling. See gis.stackexchange.com/questions/149205 In your example A>B via 1-2-3 would incur two node penalties with global turns. However so would upper left end of 2 to B (2-2-3). Note time and length are independent cost solves - length is just a factor of time along with speed. You're really only concerned with travel time. Sep 23, 2015 at 18:39
• @Chris W Thanks, I will look at the link you provided. Anyway, you already found the problem: the node would be accounted for even starting from the upper left end of 2 to B, and this is sometging I nave to avoid. Sep 23, 2015 at 19:15
• That only happens if you use global turns. If you model individual turns, each different movement can be given a different delay - so straight through on 2 would have no delay, but a left or right onto 1 would have a ten minute or whatever delay. Another (convoluted and not recommended) approach would be creating a multi-modal network and using each bus route as a separate mode/network. There's an option to introduce a delay when changing modes. Sep 23, 2015 at 19:23
• Consider adding "Point" cost barriers.
– Jeff
Sep 28, 2015 at 20:54

## 1 Answer

Consider adding "Point" cost barriers. See Barriers.