<?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: agolservices.FindRoutes not working? (Messages say &amp;quot;Successful&amp;quot;, but output won't save) in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/agolservices-findroutes-not-working-messages-say/m-p/1337581#M68951</link>
    <description>&lt;P&gt;Any luck at getting this figured out, I am having similar issues with using the&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;arcpy.agolservices&lt;/PRE&gt;</description>
    <pubDate>Fri, 13 Oct 2023 02:17:17 GMT</pubDate>
    <dc:creator>frobertsmaf</dc:creator>
    <dc:date>2023-10-13T02:17:17Z</dc:date>
    <item>
      <title>agolservices.FindRoutes not working? (Messages say "Successful", but output won't save)</title>
      <link>https://community.esri.com/t5/python-questions/agolservices-findroutes-not-working-messages-say/m-p/1323675#M68492</link>
      <description>&lt;P&gt;Hello, I am trying to loop through two layers (stops and barriers), and select from each using a common ID. Once the appropriate stops and barriers are selected, I would like to run the Find Routes tool using AGOL's routing service. I am prepared to have the script use credits and I have ensured I have enough, so the issue is not related to that as far as I know.&lt;/P&gt;&lt;P&gt;I am importing the Route module like so:&amp;nbsp;&lt;/P&gt;&lt;P&gt;gis = GIS("Pro") # I am logged into my organization through ArcGIS Pro&amp;nbsp;&lt;/P&gt;&lt;P&gt;route_service = "&lt;A href="https://logistics.arcgis.com/arcgis/services;World/Route" target="_blank" rel="noopener"&gt;https://logistics.arcgis.com/arcgis/services;World/Route&lt;/A&gt;;"&lt;BR /&gt;arcpy.ImportToolbox(route_service)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then loop through everything using the following code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# Create stops layer&lt;BR /&gt;arcpy.MakeFeatureLayer_management(start_end_points,"stops_lyr")&lt;/P&gt;&lt;P&gt;## Create bridge barriers&lt;BR /&gt;arcpy.analysis.Buffer(bridges, barriers, "10 Meters", "FULL", "ROUND", "NONE")&lt;BR /&gt;arcpy.MakeFeatureLayer_management(barriers,"barriers_lyr")&lt;/P&gt;&lt;P&gt;bridge_list = [55, 37, 12]&lt;BR /&gt;for b in bridge_list:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; # Select relevant stops and barriers for routes&lt;BR /&gt;&amp;nbsp; &amp;nbsp; barrier_query = """"ORIG_FID" = {}""".format(b)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; stops_query = """Bridge_OID = '{}'""".format(b)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; arcpy.management.SelectLayerByAttribute("barriers_lyr", "NEW_SELECTION", barrier_query)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; arcpy.management.SelectLayerByAttribute("stops_lyr", "NEW_SELECTION", stops_query)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; # Run Route tool&lt;BR /&gt;&amp;nbsp; &amp;nbsp; result = arcpy.agolservices.FindRoutes("stops_lyr", "Minutes", "NorthAmerica", Return_to_Start=True,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Polygon_Barriers = "barriers_lyr", Use_Hierarchy=True, Travel_Mode="Custom",&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Output_Format="Feature Set")&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;SPAN&gt;result.getOutput(&lt;/SPAN&gt;&lt;SPAN class=""&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;).save(output_routes)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The above results in the following error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;RuntimeError&lt;/SPAN&gt;: ResultObject: Error in getting output&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My credit usage is not going down so I don't think the tool is even running. When I call results.status, I get "4" as a result, and the messages all say that it was a success.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Aug 2023 20:55:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/agolservices-findroutes-not-working-messages-say/m-p/1323675#M68492</guid>
      <dc:creator>MaryGraceMcClellan</dc:creator>
      <dc:date>2023-08-29T20:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: agolservices.FindRoutes not working? (Messages say "Successful", but output won't save)</title>
      <link>https://community.esri.com/t5/python-questions/agolservices-findroutes-not-working-messages-say/m-p/1337581#M68951</link>
      <description>&lt;P&gt;Any luck at getting this figured out, I am having similar issues with using the&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;arcpy.agolservices&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Oct 2023 02:17:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/agolservices-findroutes-not-working-messages-say/m-p/1337581#M68951</guid>
      <dc:creator>frobertsmaf</dc:creator>
      <dc:date>2023-10-13T02:17:17Z</dc:date>
    </item>
    <item>
      <title>Re: agolservices.FindRoutes not working? (Messages say "Successful", but output won't save)</title>
      <link>https://community.esri.com/t5/python-questions/agolservices-findroutes-not-working-messages-say/m-p/1357357#M69337</link>
      <description>&lt;P&gt;Hi, sorry for the delay in responding! I guess I don't get notifications. I ended up using&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.na.AddLocations()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I input my network and points, etc, then:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;result = arcpy.na.Solve("Route", "SKIP", "TERMINATE", None, '') &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, to access the routes layer, I looped through `result` like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;if result.status == 4:
    for x in result.getOutput(0).listLayers():
        if x.name == "Routes":
            [analyze route here]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this helps!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 14:30:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/agolservices-findroutes-not-working-messages-say/m-p/1357357#M69337</guid>
      <dc:creator>MaryGraceMcClellan</dc:creator>
      <dc:date>2023-12-06T14:30:46Z</dc:date>
    </item>
  </channel>
</rss>

