<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Dynamically changing Travel_Mode in PrepareTimeLapsePolygons in Public Transit Questions</title>
    <link>https://community.esri.com/t5/public-transit-questions/dynamically-changing-travel-mode-in/m-p/1291884#M597</link>
    <description>&lt;P&gt;(note: I deleted my previous response as I was looking at the wrong thing when I tested the solution.)&lt;/P&gt;&lt;P&gt;Ok, I put that code in at line 11. Now when I run the script, I get an error "ERROR 000840: The value is not a String." stemming from line 16. If I change line 16 to be "Travel_Mode=scenario," the string name of my new mode, I get the error "ERROR 000800: The value is not a member of Public transit time | Public transit time with wheelchair"&lt;/P&gt;&lt;P&gt;Is it just a matter of turning off whatever type check is on "Travel_Mode" to allow it to accept a dictionary?&lt;/P&gt;</description>
    <pubDate>Mon, 22 May 2023 23:07:29 GMT</pubDate>
    <dc:creator>KD_</dc:creator>
    <dc:date>2023-05-22T23:07:29Z</dc:date>
    <item>
      <title>Dynamically changing Travel_Mode in PrepareTimeLapsePolygons</title>
      <link>https://community.esri.com/t5/public-transit-questions/dynamically-changing-travel-mode-in/m-p/1291471#M594</link>
      <description>&lt;P&gt;I have no idea if this is possible, but thought it was worth asking in an effort to avoid manual work.&lt;/P&gt;&lt;P&gt;I'm accessing&amp;nbsp;&lt;SPAN&gt;Transit Network Analysis Tools (v0.8.0) toolbox in a python notebook (Pro v3.1). My GTFS network is using the standard template available&amp;nbsp;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&amp;nbsp;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?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;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
        )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2023 03:59:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/dynamically-changing-travel-mode-in/m-p/1291471#M594</guid>
      <dc:creator>KD_</dc:creator>
      <dc:date>2023-05-22T03:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically changing Travel_Mode in PrepareTimeLapsePolygons</title>
      <link>https://community.esri.com/t5/public-transit-questions/dynamically-changing-travel-mode-in/m-p/1291589#M595</link>
      <description>&lt;P&gt;Thankfully, this one has an easy solution!&lt;/P&gt;&lt;P&gt;You just need to set&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;new_travel_mode.attributeParameters = attr_params&lt;/LI-CODE&gt;&lt;P&gt;after modifying the travel mode.&amp;nbsp; The TravelMode object doesn't allow you to edit the attribute parameters in place.&amp;nbsp; It won't pick up the changes.&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2023 14:16:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/dynamically-changing-travel-mode-in/m-p/1291589#M595</guid>
      <dc:creator>MelindaMorang</dc:creator>
      <dc:date>2023-05-22T14:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically changing Travel_Mode in PrepareTimeLapsePolygons</title>
      <link>https://community.esri.com/t5/public-transit-questions/dynamically-changing-travel-mode-in/m-p/1291884#M597</link>
      <description>&lt;P&gt;(note: I deleted my previous response as I was looking at the wrong thing when I tested the solution.)&lt;/P&gt;&lt;P&gt;Ok, I put that code in at line 11. Now when I run the script, I get an error "ERROR 000840: The value is not a String." stemming from line 16. If I change line 16 to be "Travel_Mode=scenario," the string name of my new mode, I get the error "ERROR 000800: The value is not a member of Public transit time | Public transit time with wheelchair"&lt;/P&gt;&lt;P&gt;Is it just a matter of turning off whatever type check is on "Travel_Mode" to allow it to accept a dictionary?&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2023 23:07:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/dynamically-changing-travel-mode-in/m-p/1291884#M597</guid>
      <dc:creator>KD_</dc:creator>
      <dc:date>2023-05-22T23:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically changing Travel_Mode in PrepareTimeLapsePolygons</title>
      <link>https://community.esri.com/t5/public-transit-questions/dynamically-changing-travel-mode-in/m-p/1292111#M598</link>
      <description>&lt;P&gt;Oh dear, I believe this is actually a bug in the tool.&amp;nbsp; I see that for some reason the travel mode parameter is a string-type parameter instead of a travel mode.&amp;nbsp; I honestly can't remember why I implemented it that way years ago, but it has the effect of preventing this very reasonable workflow from working.&lt;/P&gt;&lt;P&gt;I think the fix should be straightforward but will require a bit of testing on my end.&amp;nbsp; Let me make sure I don't have anything else urgent to take care of today, and then I'll try to fix this for you.&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2023 15:06:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/dynamically-changing-travel-mode-in/m-p/1292111#M598</guid>
      <dc:creator>MelindaMorang</dc:creator>
      <dc:date>2023-05-23T15:06:13Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically changing Travel_Mode in PrepareTimeLapsePolygons</title>
      <link>https://community.esri.com/t5/public-transit-questions/dynamically-changing-travel-mode-in/m-p/1292314#M599</link>
      <description>&lt;P&gt;I've fixed the problem and updated the toolbox.&amp;nbsp; You can get it from&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://www.arcgis.com/home/item.html?id=23cc1b720eb0418db4d0e61955b8fe43" target="_blank" rel="noopener"&gt;ArcGIS Online&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;or&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://github.com/Esri/public-transit-tools/tree/master/transit-network-analysis-tools" target="_blank" rel="noopener"&gt;GitHub&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 23 May 2023 20:54:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/dynamically-changing-travel-mode-in/m-p/1292314#M599</guid>
      <dc:creator>MelindaMorang</dc:creator>
      <dc:date>2023-05-23T20:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically changing Travel_Mode in PrepareTimeLapsePolygons</title>
      <link>https://community.esri.com/t5/public-transit-questions/dynamically-changing-travel-mode-in/m-p/1292911#M600</link>
      <description>&lt;P&gt;Awesome, thanks so much for your help as always.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;SPAN&gt;&amp;nbsp;I honestly can't remember why I implemented it that way years ago&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;^ Story of my life!&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2023 04:32:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/public-transit-questions/dynamically-changing-travel-mode-in/m-p/1292911#M600</guid>
      <dc:creator>KD_</dc:creator>
      <dc:date>2023-05-25T04:32:37Z</dc:date>
    </item>
  </channel>
</rss>

