<?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: Combining GeoLocator and selecting a destination to create route in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/combining-geolocator-and-selecting-a-destination/m-p/174215#M16167</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;John,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; This would not be to hard. The big step combining what you have with the geolocate sample. I would concentrate on this first, once you have that worked out all you need to do is use the routeParams.stops.features.push(stop); and make sure that the point you add has a spatial reference set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN class="pln"&gt;&lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;var&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; pt &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;new&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="typ"&gt;Point&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;location&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;coords&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;longitude&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; location&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;coords&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;latitude&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;);
routeParams.stops.features.push(pt);&lt;/SPAN&gt;
&lt;SPAN class="pln"&gt;

&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;Now the second link from your infoWindow is a lot trickier first you would add a button to the infoWindow to fire the event that adds the second stop:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

if (typeof statsLink === 'undefined') {


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var statsLink = dojo.create("a", {


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "class": "action",


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "id": 'statsLink',


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "innerHTML": "Inspect Unit",


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; style: "cursor: pointer;"


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }, dojo.query(".actionList", map.infoWindow.domNode)[0]);


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on(statsLink, "click", yourFunction);


}

&lt;/PRE&gt;&lt;P&gt; and yourFunction would do the same thing as the first code block i.e. add the map point to the routeParams.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry I don't have time to go into more detail. This is all I have time for as I am leaving for a week long trip, hope this is enough to get you started.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 09:00:16 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2021-12-11T09:00:16Z</dc:date>
    <item>
      <title>Combining GeoLocator and selecting a destination to create route</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/combining-geolocator-and-selecting-a-destination/m-p/174214#M16166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a Network Analysis service that works fine in the the attached code.&amp;nbsp; I like the simplicity of adding points and a route being solved.&amp;nbsp; I'm wondering if this could be further enhanced (which may be a toll order).&amp;nbsp; What I'm trying to do is use the geoLocation sample here &lt;A href="https://developers.arcgis.com/javascript/jssamples/exp_geolocate.html" title="https://developers.arcgis.com/javascript/jssamples/exp_geolocate.html"&gt;Geolocation | ArcGIS API for JavaScript&lt;/A&gt;‌, have that act as my first input point and then click on a link link inside the infoWindow of a feature in my feature layer to add it as my second input point and then have that trigger the route solve.&amp;nbsp; Would it also be possible to have turn-by-turn directions output as well?&amp;nbsp; Sort of like the sample here: &lt;A href="https://developers.arcgis.com/javascript/jssamples/widget_directions_basic.html" title="https://developers.arcgis.com/javascript/jssamples/widget_directions_basic.html"&gt;Directions | ArcGIS API for JavaScript&lt;/A&gt;‌.&amp;nbsp; Let me know if you have any other questions or there's anything else I can provide.&amp;nbsp; Right now I can solve the route by clicking on two places on the map, but I can't get turn-by-turn directions, even getting that might be helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jul 2014 04:30:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/combining-geolocator-and-selecting-a-destination/m-p/174214#M16166</guid>
      <dc:creator>JohnPapageorgiou</dc:creator>
      <dc:date>2014-07-21T04:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: Combining GeoLocator and selecting a destination to create route</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/combining-geolocator-and-selecting-a-destination/m-p/174215#M16167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;John,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; This would not be to hard. The big step combining what you have with the geolocate sample. I would concentrate on this first, once you have that worked out all you need to do is use the routeParams.stops.features.push(stop); and make sure that the point you add has a spatial reference set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN class="pln"&gt;&lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;var&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; pt &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd"&gt;new&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="typ"&gt;Point&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;location&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;coords&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;longitude&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; location&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;coords&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;latitude&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;);
routeParams.stops.features.push(pt);&lt;/SPAN&gt;
&lt;SPAN class="pln"&gt;

&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;Now the second link from your infoWindow is a lot trickier first you would add a button to the infoWindow to fire the event that adds the second stop:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

if (typeof statsLink === 'undefined') {


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var statsLink = dojo.create("a", {


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "class": "action",


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "id": 'statsLink',


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "innerHTML": "Inspect Unit",


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; style: "cursor: pointer;"


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }, dojo.query(".actionList", map.infoWindow.domNode)[0]);


&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on(statsLink, "click", yourFunction);


}

&lt;/PRE&gt;&lt;P&gt; and yourFunction would do the same thing as the first code block i.e. add the map point to the routeParams.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry I don't have time to go into more detail. This is all I have time for as I am leaving for a week long trip, hope this is enough to get you started.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:00:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/combining-geolocator-and-selecting-a-destination/m-p/174215#M16167</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-11T09:00:16Z</dc:date>
    </item>
  </channel>
</rss>

