I have no idea if this is possible, but thought it was worth asking in an effort to avoid manual work.
I'm accessing Transit Network Analysis Tools (v0.8.0) toolbox in a python notebook (Pro v3.1). My GTFS network is using the standard template available from ESRI. I want to run several scenarios of altered mode attribute parameters and would ideally define these in my script. I'm looping my scenarios which reference dictionaries to define the parameters for modified travel modes. But I can't get those new attributes or new modes to "stick" when I run the PrepareTimeLapsePolygons tool. Am I doing something wrong, can I tweak the source code somewhere, or am I doomed to manually create 10+ travel modes using the conventional interface?
Note: The script works when the travel mode manipulation is removed and I set the mode to "Public transit time" in line 16, so I'm confident my other variables in here are ok.
nd_layer_name="PT_network"
arcpy.nax.MakeNetworkDatasetLayer(PTNetwork,nd_layer_name)
for scenario in Scenarios_to_run:
nd_travel_modes = arcpy.nax.GetTravelModes(nd_layer_name)
new_travel_mode = arcpy.nax.TravelMode(nd_travel_modes["Public transit time"])
new_travel_mode.name = scenario
attr_params = new_travel_mode.attributeParameters
attr_params[('PublicTransitTime', 'Exclude modes')]=typedict[scenario] #set type exclusion
attr_params[('PublicTransitTime', 'Exclude lines')]=routedict[scenario] #set route exclusion
arcpy.TransitNetworkAnalysisTools.PrepareTimeLapsePolygons(
Facilities=facilityfile,
Output_Polygons=outputfc,
Network_Data_Source=nd_layer_name,
Travel_Mode=new_travel_mode, #also tried setting this to the name of the new mode(scenario)
Cutoff_Times=[30],
Cutoff_Time_Units="Minutes",
Start_Day__Weekday_or_YYYYMMDD_date_=PTRunDate,
Start_Time__HH_MM___24_hour_time_=PTStartTime,
End_Day__Weekday_or_YYYYMMDD_date_=PTRunDate,
End_Time__HH_MM___24_hour_time_=PTEndTime,
Time_Increment__minutes_=time_increment,
Travel_Direction=direction,
Geometry_At_Cutoff="Disks",
Geometry_At_Overlap=overlap_or_dissolve,
Max_Processes=ParallelProcesses,
Barriers=None,
Precalculate_Network_Locations=True
)