How to set more than one cost attributes

702
6
12-17-2019 01:43 PM
jianhedu
New Contributor

Hey, 

I am using arcpy.na.solve to find the best transit route using network converted from GTFS data.  I need two cost attributes to be combined: public transit time and walk time. How should I set up the travel mode? 

Here is what I use for public transit only (which works fine):

travel_mode = "Public transit time"

arcpy.na.MakeRouteAnalysisLayer('TransitNetwork_ND','Route',travel_mode)

Thanks

Jane

0 Kudos
6 Replies
MelindaMorang
Esri Regular Contributor

Hi Jane.  What do you mean by you "need two cost attributes to be combined"?

If you created your network dataset using the template provided with the tutorial in the ArcGIS Pro documentation, then the "Public transit time" travel mode is already configured to calculate walk time along streets and transit time along transit lines.  When you solve a network analysis problem (like a Route) using "Public transit time" as the travel mode, it finds the optimal solution by considering the time it takes to walk along streets and ride public transit.  You don't need to configure anything specific.

0 Kudos
jianhedu
New Contributor

Thanks for replying, Melinda.  My analysis needs to separate the walking time and the transit time on train/bus.  And due to the size of my data, I need to use Python command to do the Network Analysis instead of clicking on buttons on the menu. 

When I tested the menu options (so that I can create my arcPy commend accordingly), I found that the output route file only provides values for "Total_PublicTransitTime" if I choose "Mode: Public trasnit time " in the "Travel Settings" banner in the Network Analysis.  The output column "Total_walktime" will be "null". However, if I clicked on the blue

sum sign and check both "PublicTransitTime" and "WalkTime", the output file will give me the walk time I need. Is there anyway to include this option into the python command?  

0 Kudos
MelindaMorang
Esri Regular Contributor

When you create your Route layer in python, use the accumulate_attributes parameter to accumulate the WalkTime attribute.  Make Route Analysis Layer—ArcGIS Pro | ArcGIS Desktop 

Keep in mind that the Total_PublicTransitTime will include the walking time, so to get the transit+wait time, subtract off the Total_WalkTime.

jianhedu
New Contributor

Thanks!

0 Kudos
jianhedu
New Contributor

Is there a way to generate values for "wait time", "walk time" and "transit time" separately? 

0 Kudos
MelindaMorang
Esri Regular Contributor

No, there is not currently a way to separate the wait time from the transit time.

0 Kudos