# Calculating travel time from residential points to stores via public transit using ArcGIS for Desktop?

I don't know how to summarize it in just one title, but here is the problem:

My goal is to calculate the travel time from residential points to stores via public transit. Basically this period of time consists three parts:

1. The walking time from a residential point to the nearest bus stop "t1", which can be calculated by the Nearest Facility tool from Network Analyst. The resulting table is called "Resident_Stop", of which the number of records is m;

2. The bus-riding time "t2" from this bus stop to the nearest bus stop of the target store via bus route, which is a record from Network Analyst's OD Time Matrix table, namely, "Stop_Stop". The origins and destinations are all bus stops on one single bus route so that the number of records is s*s;

3. The walking time from the ending bus stop to the store "t3", which is basically the same with the first step. The table is "Stop_Store", of which the number of records is n.

So the total travel time "t" equals to (t1+t2+t3) and here is where problem occurs: I haven't figured out a way to attach the three tables reasonably to add the times on using a join. Currently I have an OD Time Matrix table of the walking time directly from residential points to stores via road network (no transit involved) and its number of records is m*n. I also separatly joined the table "Resident_Stop" in step 1 and the table "Stop_Store" in step 3 to the m*n-sized table based on residential point IDs and store IDs. So the remaining thing now is to assign the bus-riding time in table 2 based on table 1's stop IDs and table 3's stop IDs to each of the m*n records. Then I can get the total time.

Should you get any ideas, I'm willing to discuss with you. I'm now thinking about using Python to handle this but I'm a beginner on that. If you have any books or tutorials to recommand please tell me.

• This is a big job for a beginner. Perhaps break it down into steps rather than looking at it as one big problem. So you have no trouble calculating the individual times, is that right? Jul 29, 2014 at 4:15
• Yes, all the individual tables are ready. Jul 29, 2014 at 4:16
• Is there a unique id between the 3 tables for each trip? Jul 29, 2014 at 4:17
• Yes. Between 1 and 2 it is the ID of the nearest stop from the residential point. Between 3 and 2 it is the ID of the nearest stop from the store. Jul 29, 2014 at 4:19
• This looks a multi-modal network analysis but as Michael said it is too broad for one GIS SE question so we will need you to work through it in a series of focussed Q&As.
– PolyGeo
Jul 29, 2014 at 5:47

## 1 Answer

I'll demonstrate my suggestion using 14 bus stops:

The trick here is to modify Stop_Stop matrix into shorter table:

The store is closest to stop 8, thus above table can be reduced to 14 rows by Create Feature Layer (Model builder) or changing Definition Query (script) to [From_Stop]=8. Similar thing has to be done with stops2store table, so it will contain only 1 row:

Start your journeys by joining house2stop, stop2stop and stop2store tables as shown below:

Add field Total to house2stop, and use field calculator to convert distance fields (last fields in above picture) to travel time. Example below shows distances only:

All this is doable using Model Builder and can be extended to the case with multiple stores, using store ID and 'Total' field name as parameters. It woul de nice though to let some of them just walk:) Note: it was tested on FGDB tables.

• Thank you for your in-depth answers. But one thing is that I got multiple stores and there is a chance that more than 1 stores share 1 bus stop, so problem will occur when joining Stop_Stop and Stop_Store tables. Plus there is multiple bus routes. Another problem I just discovered is that when using OD Time Matrix tool to generate Stop_Stop table, I always get tables with number of records less than s*s. Do you know what may cause that? Jul 31, 2014 at 20:54
• Multiple routes is not an issue, it just make your stop_stop table longer. I hope you are not going to save travel to multiple stores in 1 field. If we can agree on this, the number of target stores is not an issue, travel times to N stores simply have to be saved in N fields. You have to iterate through stores, making one at a time THE target. Period. Without seeing your network I cannot answer s*s question. Jul 31, 2014 at 21:20
• OK, I understand you. So for one bus route I can only process one store for all residential points with one operation, right? Unfortunately I got 297 stores and 30 bus routes and that's gonna be near 9,000 operations. Is there some methods to automate your process and iterate through stores automatically? Aug 1, 2014 at 2:58
• No, you can process one store with many routes. Important thing is to figure out what are you trying to achieve. Travel time from every house to every 297 stores? Or maybe to find the store that is fastest to reach from any house. Both actually achievable with Model Builder, but first one will add 297 fields to your houses table. Python is much better solution in any case though Aug 1, 2014 at 4:07
• Yes your table stop_stop must include all 30 routes, i.e. let them change the bus while shopping Aug 1, 2014 at 4:10