<?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 Generate Routes from User Location - Direction Widget in ArcGIS Web AppBuilder Questions</title>
    <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/generate-routes-from-user-location-direction/m-p/43771#M1183</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;When i click the Get Directions button or did an internal call to get the directions, it is not taking my current position for the route calculation. And i have included the piece of code&amp;nbsp;&lt;STRONG&gt;directions.useMyCurrentLocation(stopIndex)&amp;nbsp;&lt;/STRONG&gt;to include my current location.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how to overcome this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please refer the screenshot and the code for the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/414898_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;BR /&gt;&amp;lt;html&amp;gt;&lt;BR /&gt; &amp;lt;head&amp;gt;&lt;BR /&gt; &amp;lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&amp;gt;&lt;BR /&gt; &amp;lt;meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"&amp;gt;&lt;BR /&gt; &amp;lt;title&amp;gt;Directions Widget&amp;lt;/title&amp;gt;&lt;BR /&gt;&lt;SPAN&gt; &amp;lt;link rel="stylesheet" href="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fjs.arcgis.com%2F3.25%2Fdijit%2Fthemes%2Fclaro%2Fclaro.css" rel="nofollow" target="_blank"&gt;https://js.arcgis.com/3.25/dijit/themes/claro/claro.css&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &amp;lt;link rel="stylesheet" href="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fjs.arcgis.com%2F3.25%2Fesri%2Fcss%2Fesri.css" rel="nofollow" target="_blank"&gt;https://js.arcgis.com/3.25/esri/css/esri.css&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt; &amp;lt;style&amp;gt;&lt;BR /&gt; html, body, #map {&lt;BR /&gt; height:100%;&lt;BR /&gt; width:100%;&lt;BR /&gt; margin:0;&lt;BR /&gt; padding:0;&lt;BR /&gt; }&lt;BR /&gt; body {&lt;BR /&gt; background-color:#FFF;&lt;BR /&gt; overflow:hidden;&lt;BR /&gt; font-family:"Trebuchet MS";&lt;BR /&gt; }&lt;BR /&gt; &amp;lt;/style&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;lt;script src="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fjs.arcgis.com%2F3.25%2F" rel="nofollow" target="_blank"&gt;https://js.arcgis.com/3.25/&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;&amp;lt;/script&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt; &amp;lt;script&amp;gt;&lt;BR /&gt; require([&lt;BR /&gt; "esri/urlUtils", "esri/map", "esri/dijit/Directions","esri/dijit/LocateButton",&lt;BR /&gt; "dojo/parser",&lt;BR /&gt; "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!"&lt;BR /&gt; ], function(&lt;BR /&gt; urlUtils, Map, Directions,LocateButton,&lt;BR /&gt; parser&lt;BR /&gt; ) {&lt;BR /&gt; parser.parse();&lt;BR /&gt; var map = new Map("map", {&lt;BR /&gt; basemap: "streets",&lt;BR /&gt; center:[-98.56,39.82],&lt;BR /&gt; zoom: 4&lt;BR /&gt; });&lt;BR /&gt; var geoLocate = new LocateButton({&lt;BR /&gt; map: map,&lt;BR /&gt; highlightLocation: true&lt;BR /&gt; }, "LocateButton"&lt;BR /&gt; );&lt;BR /&gt; geoLocate.startup();&lt;BR /&gt; //default will point to ArcGIS world routing service&lt;BR /&gt; var directions = new Directions({&lt;BR /&gt; map: map&lt;BR /&gt; // --------------------------------------------------------------------&lt;BR /&gt; // New constuctor option and property showSaveButton added at version&lt;BR /&gt; // 3.17 to allow saving route. For more information see the API Reference.&lt;BR /&gt;&lt;SPAN&gt; // &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fdevelopers.arcgis.com%2Fjavascript%2F3%2Fjsapi%2Fdirections-amd.html%23showsavebutton" rel="nofollow" target="_blank"&gt;https://developers.arcgis.com/javascript/3/jsapi/directions-amd.html#showsavebutton&lt;/A&gt;&lt;BR /&gt; //&lt;BR /&gt; // Uncomment the line below to add the save button to the Directions widget&lt;BR /&gt; // --------------------------------------------------------------------&lt;BR /&gt; // , showSaveButton: true&lt;BR /&gt; },"dir");&lt;BR /&gt; directions.startup();&lt;BR /&gt; &lt;BR /&gt; on(dom.byId("LocateButton"), "click", function () {&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;directions.useMyCurrentLocation(0);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; directions.getDirections();&lt;/STRONG&gt;&lt;BR /&gt; });&lt;BR /&gt; &lt;BR /&gt; });&lt;BR /&gt; &amp;lt;/script&amp;gt;&lt;BR /&gt; &amp;lt;/head&amp;gt;&lt;BR /&gt; &amp;lt;body class="claro"&amp;gt;&lt;BR /&gt; &amp;lt;div data-dojo-type="dijit/layout/BorderContainer"&lt;BR /&gt; data-dojo-props="design:'headline', gutters:false"&lt;BR /&gt; style="width:100%;height:100%;"&amp;gt;&lt;BR /&gt; &amp;lt;div data-dojo-type="dijit/layout/ContentPane"&lt;BR /&gt; data-dojo-props="region:'right'"&lt;BR /&gt; style="width:250px;"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;div id="dir"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt; &amp;lt;/div&amp;gt;&lt;BR /&gt; &amp;lt;div id="map"&lt;BR /&gt; data-dojo-type="dijit/layout/ContentPane"&lt;BR /&gt; data-dojo-props="region:'center'"&amp;gt; &amp;lt;div id="LocateButton"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt; &amp;lt;/div&amp;gt;&lt;BR /&gt; &amp;lt;/div&amp;gt;&lt;BR /&gt; &amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;Siva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Jul 2018 07:45:12 GMT</pubDate>
    <dc:creator>SivaramKrishnan2</dc:creator>
    <dc:date>2018-07-24T07:45:12Z</dc:date>
    <item>
      <title>Generate Routes from User Location - Direction Widget</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/generate-routes-from-user-location-direction/m-p/43771#M1183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;When i click the Get Directions button or did an internal call to get the directions, it is not taking my current position for the route calculation. And i have included the piece of code&amp;nbsp;&lt;STRONG&gt;directions.useMyCurrentLocation(stopIndex)&amp;nbsp;&lt;/STRONG&gt;to include my current location.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how to overcome this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please refer the screenshot and the code for the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/414898_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;BR /&gt;&amp;lt;html&amp;gt;&lt;BR /&gt; &amp;lt;head&amp;gt;&lt;BR /&gt; &amp;lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&amp;gt;&lt;BR /&gt; &amp;lt;meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"&amp;gt;&lt;BR /&gt; &amp;lt;title&amp;gt;Directions Widget&amp;lt;/title&amp;gt;&lt;BR /&gt;&lt;SPAN&gt; &amp;lt;link rel="stylesheet" href="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fjs.arcgis.com%2F3.25%2Fdijit%2Fthemes%2Fclaro%2Fclaro.css" rel="nofollow" target="_blank"&gt;https://js.arcgis.com/3.25/dijit/themes/claro/claro.css&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &amp;lt;link rel="stylesheet" href="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fjs.arcgis.com%2F3.25%2Fesri%2Fcss%2Fesri.css" rel="nofollow" target="_blank"&gt;https://js.arcgis.com/3.25/esri/css/esri.css&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt; &amp;lt;style&amp;gt;&lt;BR /&gt; html, body, #map {&lt;BR /&gt; height:100%;&lt;BR /&gt; width:100%;&lt;BR /&gt; margin:0;&lt;BR /&gt; padding:0;&lt;BR /&gt; }&lt;BR /&gt; body {&lt;BR /&gt; background-color:#FFF;&lt;BR /&gt; overflow:hidden;&lt;BR /&gt; font-family:"Trebuchet MS";&lt;BR /&gt; }&lt;BR /&gt; &amp;lt;/style&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;lt;script src="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fjs.arcgis.com%2F3.25%2F" rel="nofollow" target="_blank"&gt;https://js.arcgis.com/3.25/&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;&amp;lt;/script&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt; &amp;lt;script&amp;gt;&lt;BR /&gt; require([&lt;BR /&gt; "esri/urlUtils", "esri/map", "esri/dijit/Directions","esri/dijit/LocateButton",&lt;BR /&gt; "dojo/parser",&lt;BR /&gt; "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!"&lt;BR /&gt; ], function(&lt;BR /&gt; urlUtils, Map, Directions,LocateButton,&lt;BR /&gt; parser&lt;BR /&gt; ) {&lt;BR /&gt; parser.parse();&lt;BR /&gt; var map = new Map("map", {&lt;BR /&gt; basemap: "streets",&lt;BR /&gt; center:[-98.56,39.82],&lt;BR /&gt; zoom: 4&lt;BR /&gt; });&lt;BR /&gt; var geoLocate = new LocateButton({&lt;BR /&gt; map: map,&lt;BR /&gt; highlightLocation: true&lt;BR /&gt; }, "LocateButton"&lt;BR /&gt; );&lt;BR /&gt; geoLocate.startup();&lt;BR /&gt; //default will point to ArcGIS world routing service&lt;BR /&gt; var directions = new Directions({&lt;BR /&gt; map: map&lt;BR /&gt; // --------------------------------------------------------------------&lt;BR /&gt; // New constuctor option and property showSaveButton added at version&lt;BR /&gt; // 3.17 to allow saving route. For more information see the API Reference.&lt;BR /&gt;&lt;SPAN&gt; // &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fdevelopers.arcgis.com%2Fjavascript%2F3%2Fjsapi%2Fdirections-amd.html%23showsavebutton" rel="nofollow" target="_blank"&gt;https://developers.arcgis.com/javascript/3/jsapi/directions-amd.html#showsavebutton&lt;/A&gt;&lt;BR /&gt; //&lt;BR /&gt; // Uncomment the line below to add the save button to the Directions widget&lt;BR /&gt; // --------------------------------------------------------------------&lt;BR /&gt; // , showSaveButton: true&lt;BR /&gt; },"dir");&lt;BR /&gt; directions.startup();&lt;BR /&gt; &lt;BR /&gt; on(dom.byId("LocateButton"), "click", function () {&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;directions.useMyCurrentLocation(0);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; directions.getDirections();&lt;/STRONG&gt;&lt;BR /&gt; });&lt;BR /&gt; &lt;BR /&gt; });&lt;BR /&gt; &amp;lt;/script&amp;gt;&lt;BR /&gt; &amp;lt;/head&amp;gt;&lt;BR /&gt; &amp;lt;body class="claro"&amp;gt;&lt;BR /&gt; &amp;lt;div data-dojo-type="dijit/layout/BorderContainer"&lt;BR /&gt; data-dojo-props="design:'headline', gutters:false"&lt;BR /&gt; style="width:100%;height:100%;"&amp;gt;&lt;BR /&gt; &amp;lt;div data-dojo-type="dijit/layout/ContentPane"&lt;BR /&gt; data-dojo-props="region:'right'"&lt;BR /&gt; style="width:250px;"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;div id="dir"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt; &amp;lt;/div&amp;gt;&lt;BR /&gt; &amp;lt;div id="map"&lt;BR /&gt; data-dojo-type="dijit/layout/ContentPane"&lt;BR /&gt; data-dojo-props="region:'center'"&amp;gt; &amp;lt;div id="LocateButton"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt; &amp;lt;/div&amp;gt;&lt;BR /&gt; &amp;lt;/div&amp;gt;&lt;BR /&gt; &amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;Siva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jul 2018 07:45:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/generate-routes-from-user-location-direction/m-p/43771#M1183</guid>
      <dc:creator>SivaramKrishnan2</dc:creator>
      <dc:date>2018-07-24T07:45:12Z</dc:date>
    </item>
  </channel>
</rss>

