<?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: Extracting JSON data from routeTask in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extracting-json-data-from-routetask/m-p/585389#M54701</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;I have a same question. I want to calculate travel time of several routes. Here is my question.&lt;A _jive_internal="true" href="https://community.esri.com/thread/172864"&gt;https://community.esri.com/thread/172864&lt;/A&gt; Would you please have a look? Appreciated for any advice.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 26 Feb 2016 03:02:49 GMT</pubDate>
    <dc:creator>LinQing</dc:creator>
    <dc:date>2016-02-26T03:02:49Z</dc:date>
    <item>
      <title>Extracting JSON data from routeTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extracting-json-data-from-routetask/m-p/585387#M54699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey all&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm working on a network which is being solved using the routeTask api. I'm getting the resulting route displayed on the map fine but what I know want to be able to do is extract the accumulated attributes and display them in a &amp;lt;div&amp;gt; on the page.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The image below is showing the console with what JSON returns.&lt;/P&gt;&lt;P&gt;&lt;A href="http://puu.sh/dA4FL/ea9b80874e.png"&gt;&lt;IMG alt="ea9b80874e.png" class="image-1 jive-image" src="http://puu.sh/dA4FL/ea9b80874e.png" style="width: 620px; height: 190px;" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I've looked at the JS API documentation on the ArcGIS for Devs site as well as looking at general JS guides. I'm still relatively new to JS so i've potentially missed some more advanced code. How would I go about this?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help appreciated&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Dec 2014 19:58:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extracting-json-data-from-routetask/m-p/585387#M54699</guid>
      <dc:creator>HamishKingsbury1</dc:creator>
      <dc:date>2014-12-18T19:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting JSON data from routeTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extracting-json-data-from-routetask/m-p/585388#M54700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hamish,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your image of the JSON didn't come through.&amp;nbsp; You should be able to get the information from the route task results.&amp;nbsp; Using the route task sample at: &lt;A href="http://developers.arcgis.com/javascript/samples/routetask_find_route/" title="http://developers.arcgis.com/javascript/samples/routetask_find_route/" rel="nofollow noopener noreferrer" target="_blank"&gt;Simple Routing&lt;/A&gt; I set a breakpoint when results are displayed and drilled in to the results as shown in this image:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="routeTask.fw.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/91977_routeTask.fw.png" style="width: 620px; height: 367px;" /&gt;&lt;/P&gt;&lt;P&gt;You should then be able to get the total travel time and distance from the results something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;totDist = evt.result.routeResults[0].route.attributes.Total_Miles;
totTravelTime = evt.result.routeResults[0].route.attributes.Total_TravelTime;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can then use these values to update the &amp;lt;div&amp;gt;.&amp;nbsp; Be aware that routeTask results can vary depending on the parameters and the service being used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 01:10:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extracting-json-data-from-routetask/m-p/585388#M54700</guid>
      <dc:creator>TomSellsted</dc:creator>
      <dc:date>2021-12-12T01:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting JSON data from routeTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extracting-json-data-from-routetask/m-p/585389#M54701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;I have a same question. I want to calculate travel time of several routes. Here is my question.&lt;A _jive_internal="true" href="https://community.esri.com/thread/172864"&gt;https://community.esri.com/thread/172864&lt;/A&gt; Would you please have a look? Appreciated for any advice.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Feb 2016 03:02:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extracting-json-data-from-routetask/m-p/585389#M54701</guid>
      <dc:creator>LinQing</dc:creator>
      <dc:date>2016-02-26T03:02:49Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting JSON data from routeTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extracting-json-data-from-routetask/m-p/585390#M54702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greetings Lin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I took a look at your request and it looks like you have already solved your problem.&amp;nbsp; Well done!&amp;nbsp; Please let me know if I can be of any other assistance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Feb 2016 16:16:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extracting-json-data-from-routetask/m-p/585390#M54702</guid>
      <dc:creator>TomSellsted</dc:creator>
      <dc:date>2016-02-26T16:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting JSON data from routeTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extracting-json-data-from-routetask/m-p/585391#M54703</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;Sorry for replying you so late. Thanks for your help. I found a solution after asking you for help. There is no question now.&lt;/P&gt;&lt;P&gt;Thank you for the help again! &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;Lin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Feb 2016 07:55:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extracting-json-data-from-routetask/m-p/585391#M54703</guid>
      <dc:creator>LinQing</dc:creator>
      <dc:date>2016-02-29T07:55:53Z</dc:date>
    </item>
  </channel>
</rss>

