<?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: closestFacility question trouble with query tasks and graphics in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/closestfacility-question-trouble-with-query-tasks/m-p/208275#M19348</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you very much for the reply... &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I think I know what the issue was... I will test tomorrow. I don't think I gave the feature layer an id. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I think I was using the feature layer var name. If that is the case I will kick myself in the butt on your behalf.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll see if that gets it working and post if I have any other issues with the task occur.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Charles&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Sep 2012 03:36:31 GMT</pubDate>
    <dc:creator>Charlesshultz</dc:creator>
    <dc:date>2012-09-21T03:36:31Z</dc:date>
    <item>
      <title>closestFacility question trouble with query tasks and graphics</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/closestfacility-question-trouble-with-query-tasks/m-p/208269#M19342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have been using the API for a little bit but am really confused about results from query tasks and graphics layers...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I am trying to do I thought would be simple but...I'm stuck. I am working with the closestFacility example for my application and from what I understand it can only use graphics... That said, the way I am doing it is this...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Add 50 or so facility graphics using a query task on a feature service. I already have a feature layer from this layer but I need graphics for the closestFacility task. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Get the XY of the feature the user clicked on and turn that into a graphic&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3)well lets stop here because I do not have 1 or 2 working...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The main issue I am having is the facility graphics that I define in the initialization function comes up undefined when I try to use it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;var YardGraphicsLayer = new esri.layers.GraphicsLayer(); &amp;nbsp;&amp;nbsp;&amp;nbsp; YardGraphicsLayer.id = 'YardGraphic'; &amp;nbsp;&amp;nbsp;&amp;nbsp; map.addLayer(YardGraphicsLayer);&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; var Yardsymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 40, &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new dojo.Color([255, 0, 0]), 4), &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; new dojo.Color([0, 255, 0, 0.25]));&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; queryYards = new esri.tasks.Query(); &amp;nbsp;&amp;nbsp;&amp;nbsp; queryYards.returnGeometry = true; &amp;nbsp;&amp;nbsp;&amp;nbsp; queryYards.outFields = ["NAME_CITY", "REGION"]; &amp;nbsp;&amp;nbsp;&amp;nbsp; queryYards.where = "1=1"; &amp;nbsp;&amp;nbsp;&amp;nbsp; queryTaskYards = new esri.tasks.QueryTask("http://services.arcgis.com/s94UJcOoEa23NHUs/arcgis/rest/services/Rigs_by_Yards/FeatureServer/0"); &amp;nbsp;&amp;nbsp;&amp;nbsp; queryTaskYards.execute(queryYards, function (results) {&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var featureSet = results.features; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert("Yards: " + featureSet.length);&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var i = 0, il = featureSet.length; i &amp;lt; il; i++) { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var graphic = featureSet&lt;I&gt;; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; graphic.setSymbol(Yardsymbol); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; YardGraphicsLayer.add(graphic); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp; }, errCallback);&lt;/I&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I try map.getLayer("YardGraphicsLayer");&amp;nbsp; when I want to use the layer I get an undefined.. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;To put it easy I would like to use my own feature layers in the closest Facility example...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help would be great,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Charles&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Sep 2012 20:31:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/closestfacility-question-trouble-with-query-tasks/m-p/208269#M19342</guid>
      <dc:creator>Charlesshultz</dc:creator>
      <dc:date>2012-09-20T20:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: closestFacility question trouble with query tasks and graphics</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/closestfacility-question-trouble-with-query-tasks/m-p/208270#M19343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Before getting too deep, one thing to establish is that features in a feature layer &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;are&lt;/SPAN&gt;&lt;SPAN&gt; graphics. That is, &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/featurelayer.htm#graphics" rel="nofollow noopener noreferrer" target="_blank"&gt;featureLayer.graphics&lt;/A&gt;&lt;SPAN&gt; is an array of &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/graphic.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;esri.Graphic&lt;/A&gt;&lt;SPAN&gt; objects, the same way that graphicsLayer.graphics is an array of esri.Graphic objects.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, you should specify an ID for a layer when you create it. Instead of:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var YardGraphicsLayer = new esri.layers.GraphicsLayer();
YardGraphicsLayer.id = 'YardGraphic';
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var YardGraphicsLayer = new esri.layers.GraphicsLayer({ "id": "YardGraphic" });
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Finally, when a graphic is clicked, a reference to that graphic is available as a property on the event object. For instance, to access a graphic that is clicked, do this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
dojo.connect(graphicsLayer, "onClick", function(evt) {
&amp;nbsp; console.log("clicked graphic: ", evt.graphic);
});
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:17:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/closestfacility-question-trouble-with-query-tasks/m-p/208270#M19343</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2021-12-11T10:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: closestFacility question trouble with query tasks and graphics</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/closestfacility-question-trouble-with-query-tasks/m-p/208271#M19344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for the reply.. It looks like I did not need to do all that work when I already had a featurelayer which is a graphics layer..&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So how do I set&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; var facilities = new esri.tasks.FeatureSet();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; facilities.features = &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;to my featurelayer? I'm sure this is a simple answer...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function ClosestYard() {

&amp;nbsp;&amp;nbsp;&amp;nbsp; var facilities = new esri.tasks.FeatureSet();
&amp;nbsp;&amp;nbsp;&amp;nbsp; facilities.features = map.getLayer("featureLayerYard").graphics;&amp;nbsp; /// This is wrong way to put featurelayer into
&amp;nbsp;&amp;nbsp;&amp;nbsp; 

&amp;nbsp;&amp;nbsp;&amp;nbsp; params.facilities = facilities;
&amp;nbsp;&amp;nbsp;&amp;nbsp; params.outSpatialReference = map.spatialReference;

&amp;nbsp;&amp;nbsp;&amp;nbsp; closestFacilityTask = new esri.tasks.ClosestFacilityTask("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/NAServer/Closest Facility");
........&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:17:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/closestfacility-question-trouble-with-query-tasks/m-p/208271#M19344</guid>
      <dc:creator>Charlesshultz</dc:creator>
      <dc:date>2021-12-11T10:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: closestFacility question trouble with query tasks and graphics</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/closestfacility-question-trouble-with-query-tasks/m-p/208272#M19345</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;featureLayers provide you with some nifty tools for setting a &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/featurelayer.htm#setDefinitionExpression" rel="nofollow noopener noreferrer" target="_blank"&gt;definition expression&lt;/A&gt;&lt;SPAN&gt; to limit whats drawn, but if you are already handing on to an array of graphics attempting to pass them to a featureLayer isn't really going to make your life any easier.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;derek is definitely right that the results you have are already graphics.&amp;nbsp; you just have to remember that even though the graphics you get back when querying a layer have geometry and attributes, they don't have symbology defined yet.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;in the code snippet below we loop through the results and assign them to a new variable called graphic before adding a symbol and pushing to the map&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;dojo.forEach(featureSet.features,function(feature){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var graphic = feature;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; graphic.setSymbol(symbol);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Set the infoTemplate.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; graphic.setInfoTemplate(infoTemplate);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Add graphic to the map graphics layer.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.graphics.add(graphic);
&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; });&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but you could also skip defining the new variable name graphic and do this directly to "feature"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;dojo.forEach(featureSet.features,function(feature){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //var graphic = feature;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; feature.setSymbol(symbol);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Set the infoTemplate.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; feature.setInfoTemplate(infoTemplate);

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Add graphic to the map graphics layer.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map.graphics.add(feature);
&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; });&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/query_clickinfowindow.html" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/query_clickinfowindow.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;does that clear things up any? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:17:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/closestfacility-question-trouble-with-query-tasks/m-p/208272#M19345</guid>
      <dc:creator>JohnGravois</dc:creator>
      <dc:date>2021-12-11T10:17:21Z</dc:date>
    </item>
    <item>
      <title>Re: closestFacility question trouble with query tasks and graphics</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/closestfacility-question-trouble-with-query-tasks/m-p/208273#M19346</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think I am not understanding because I have an existing feature layer on the map and I want to assign that feature layer to the facility parameter of the geoprocessing task. That parameter takes a graphics layer which a feature layer is so my confusion come from assigning that graphic collection of the existing feature layer to the param. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;function ClosestYard() {&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var facilities = new esri.tasks.FeatureSet();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; facilities.features = map.getLayer("featureLayerYard").graphics;&amp;nbsp; /// This is wrong way to put featurelayer into Params&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; params.facilities = facilities;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; params.outSpatialReference = map.spatialReference;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; closestFacilityTask = new esri.tasks.ClosestFacilityTask("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/NAServer/Closest" rel="nofollow" target="_blank"&gt;http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/NAServer/Closest&lt;/A&gt;&lt;SPAN&gt; Facility");&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;........&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am missing the steps and not understanding how to get from existing feature layer on the map to setting that layer as the Params.facilities&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Charles&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Sep 2012 00:50:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/closestfacility-question-trouble-with-query-tasks/m-p/208273#M19346</guid>
      <dc:creator>Charlesshultz</dc:creator>
      <dc:date>2012-09-21T00:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: closestFacility question trouble with query tasks and graphics</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/closestfacility-question-trouble-with-query-tasks/m-p/208274#M19347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What does your call to closestFacilityTask.solve() look like?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code you posted looks like it should work. There's also the &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/routetask_closest_facility.html" rel="nofollow" target="_blank"&gt;Find Closest Facilities sample&lt;/A&gt;&lt;SPAN&gt; that you can use as an example.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also confirm that map.getLayer("featureLayerYard") returns your feature layer.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Sep 2012 02:44:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/closestfacility-question-trouble-with-query-tasks/m-p/208274#M19347</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2012-09-21T02:44:36Z</dc:date>
    </item>
    <item>
      <title>Re: closestFacility question trouble with query tasks and graphics</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/closestfacility-question-trouble-with-query-tasks/m-p/208275#M19348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you very much for the reply... &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I think I know what the issue was... I will test tomorrow. I don't think I gave the feature layer an id. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I think I was using the feature layer var name. If that is the case I will kick myself in the butt on your behalf.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll see if that gets it working and post if I have any other issues with the task occur.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Charles&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Sep 2012 03:36:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/closestfacility-question-trouble-with-query-tasks/m-p/208275#M19348</guid>
      <dc:creator>Charlesshultz</dc:creator>
      <dc:date>2012-09-21T03:36:31Z</dc:date>
    </item>
  </channel>
</rss>

