<?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 Adding layers to the map from queryTask in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/adding-layers-to-the-map-from-querytask/m-p/861629#M11819</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got data on my arcgis server and I want to query these data thanks to the REST API and then, show the result of the query on the map !&lt;/P&gt;&lt;P&gt;I don't know how to explain it correctly but I would like to do the same thing that is done &lt;A href="http://maps.rosreestr.ru/arcgis_js_api/sdk/help/jssamples/query_click.html" rel="nofollow noopener noreferrer" target="_blank"&gt;there&lt;/A&gt;​ but with the Web App Builder (for developpers) and not only with the API JS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For now, my query is ok and I got a result (an array of features with, in each feature, an object Attributes and an object Geometry) but then and don't understand how to show this result as a layer on my map...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _query_TablePositionSuffix: function (geoWhereClause){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var queryTask = new QueryTask(this.arcgisServerURL + this.config.table_PositionSuffix);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var query = new Query();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.returnGeometry = true;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.outSpatialReference = {"wkid":102100};
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.returnDistinctValues = false;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.outFields = ['*'];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.where = geoWhereClause;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; queryTask.execute(query, lang.hitch(this, "on_query_TablePositionSuffix"));
&amp;nbsp;&amp;nbsp;&amp;nbsp; },
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; on_query_TablePositionSuffix: function(results) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(results);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried some things like that but it didn't worked...&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array.forEach(results.features,function(feature){
&amp;nbsp;&amp;nbsp;&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;&amp;nbsp;&amp;nbsp; graphic.setSymbol(this.symbolPosition);&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; this.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;&amp;nbsp;&amp;nbsp; });&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you by advance for your help !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 10:40:57 GMT</pubDate>
    <dc:creator>FlorianCADOZ</dc:creator>
    <dc:date>2021-12-12T10:40:57Z</dc:date>
    <item>
      <title>Adding layers to the map from queryTask</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/adding-layers-to-the-map-from-querytask/m-p/861629#M11819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got data on my arcgis server and I want to query these data thanks to the REST API and then, show the result of the query on the map !&lt;/P&gt;&lt;P&gt;I don't know how to explain it correctly but I would like to do the same thing that is done &lt;A href="http://maps.rosreestr.ru/arcgis_js_api/sdk/help/jssamples/query_click.html" rel="nofollow noopener noreferrer" target="_blank"&gt;there&lt;/A&gt;​ but with the Web App Builder (for developpers) and not only with the API JS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For now, my query is ok and I got a result (an array of features with, in each feature, an object Attributes and an object Geometry) but then and don't understand how to show this result as a layer on my map...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _query_TablePositionSuffix: function (geoWhereClause){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var queryTask = new QueryTask(this.arcgisServerURL + this.config.table_PositionSuffix);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var query = new Query();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.returnGeometry = true;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.outSpatialReference = {"wkid":102100};
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.returnDistinctValues = false;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.outFields = ['*'];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.where = geoWhereClause;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; queryTask.execute(query, lang.hitch(this, "on_query_TablePositionSuffix"));
&amp;nbsp;&amp;nbsp;&amp;nbsp; },
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; on_query_TablePositionSuffix: function(results) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(results);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; },&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried some things like that but it didn't worked...&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array.forEach(results.features,function(feature){
&amp;nbsp;&amp;nbsp;&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;&amp;nbsp;&amp;nbsp; graphic.setSymbol(this.symbolPosition);&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; this.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;&amp;nbsp;&amp;nbsp; });&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you by advance for your help !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:40:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/adding-layers-to-the-map-from-querytask/m-p/861629#M11819</guid>
      <dc:creator>FlorianCADOZ</dc:creator>
      <dc:date>2021-12-12T10:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: Adding layers to the map from queryTask</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/adding-layers-to-the-map-from-querytask/m-p/861630#M11820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Florian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; It is probably a scope issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on_query_TablePositionSuffix: function(results) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array.forEach(results.features, lang.hitch(this, function(feature){
&amp;nbsp;&amp;nbsp;&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;&amp;nbsp;&amp;nbsp; graphic.setSymbol(this.symbolPosition);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.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; },&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:41:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/adding-layers-to-the-map-from-querytask/m-p/861630#M11820</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-12T10:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: Adding layers to the map from queryTask</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/adding-layers-to-the-map-from-querytask/m-p/861631#M11821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh yeah... I feel stupid...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But my real problem is that I would like to have a Layer and not graphic ! I tried to use graphics because I was a bit distraught but my problem is to add a layer shown on the map (and by extend, in the layer list and the legend...)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible with something like "this.map.addLayer(..." ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Dec 2015 16:30:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/adding-layers-to-the-map-from-querytask/m-p/861631#M11821</guid>
      <dc:creator>FlorianCADOZ</dc:creator>
      <dc:date>2015-12-22T16:30:46Z</dc:date>
    </item>
    <item>
      <title>Re: Adding layers to the map from queryTask</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/adding-layers-to-the-map-from-querytask/m-p/861632#M11822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Florian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; You will want to see this thread then:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/thread/169863"&gt;FeatureLayer from FeatureCollection&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It explains how to create a new FeatureLayer from query/selection results.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Dec 2015 16:45:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/adding-layers-to-the-map-from-querytask/m-p/861632#M11822</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2015-12-22T16:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: Adding layers to the map from queryTask</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/adding-layers-to-the-map-from-querytask/m-p/861633#M11823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Robert,&lt;/P&gt;&lt;P&gt;I'm sorry for the response time but I had to work on another project in the meantime ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So to return to the display of layers (and not graphic) I looked at the link you sent me and the associated code but I'm not sure that answers my question ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In fact, I am performing a query on a published service via ArcGIS Server and after show this service as Layer as if it were the original (with the original symbology) but filtered through a Where clause! The doc associated with my application is &lt;A href="https://developers.arcgis.com/javascript/jshelp/intro_querytask.html"&gt;here&lt;/A&gt; but there is no examples for it so I don't really understand how to do this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thx in advance for the help !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Mar 2016 14:05:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/adding-layers-to-the-map-from-querytask/m-p/861633#M11823</guid>
      <dc:creator>FlorianCADOZ</dc:creator>
      <dc:date>2016-03-24T14:05:30Z</dc:date>
    </item>
    <item>
      <title>Re: Adding layers to the map from queryTask</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/adding-layers-to-the-map-from-querytask/m-p/861634#M11824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Florian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; So why not add the layer as FeatureLayer in selection mode? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P style="margin-top: 1em; margin-bottom: 1em; font-size: 14px; color: black; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif;"&gt;In selection mode, features are retrieved from the server only when they are selected. Features are available on the client only while they are selected. To work with selected features:&lt;/P&gt;&lt;OL style="margin: 0.5em 0 0; font-size: 14px; list-style-position: inside; padding-left: 1.6em; color: #595959; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif;"&gt;&lt;LI&gt;Call the selectFeatures method.&lt;/LI&gt;&lt;LI&gt;Listen for the onSelectionComplete event.&lt;/LI&gt;&lt;LI&gt;Once onSelectionComplete fires, retrieve the selected features using the getSelectedFeatures method.&lt;/LI&gt;&lt;/OL&gt;&lt;P style="margin-top: 1em; margin-bottom: 1em; font-size: 14px; color: black; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif;"&gt;&lt;/P&gt;&lt;P style="margin-top: 1em; margin-bottom: 1em; font-size: 14px; color: black; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif;"&gt;When editing feature layers in selection mode, you will need to add the map service associated with the feature service to the map as a dynamic map service. If you do not have the map service added as a dynamic map service then the changes will not be visible because once the edits are complete the feature is no longer selected.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a sample:&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/jssamples/fl_selection.html" title="https://developers.arcgis.com/javascript/jssamples/fl_selection.html"&gt;Select features within a two minute drive time | ArcGIS API for JavaScript&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Mar 2016 14:41:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/adding-layers-to-the-map-from-querytask/m-p/861634#M11824</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2016-03-24T14:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: Adding layers to the map from queryTask</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/adding-layers-to-the-map-from-querytask/m-p/861635#M11825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;oh yeah, that sounds good ! I'll try it !&lt;/P&gt;&lt;P&gt;Thank you for that tips !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Mar 2016 14:58:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/adding-layers-to-the-map-from-querytask/m-p/861635#M11825</guid>
      <dc:creator>FlorianCADOZ</dc:creator>
      <dc:date>2016-03-24T14:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: Adding layers to the map from queryTask</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/adding-layers-to-the-map-from-querytask/m-p/861636#M11826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok I found something similar to your solution and perfect for my goal thanks to you !&lt;/P&gt;&lt;P&gt;This is the MODE_ONDEMAND with a .setDefinitionExpression !&lt;/P&gt;&lt;P&gt;Thank you very much !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Mar 2016 16:17:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/adding-layers-to-the-map-from-querytask/m-p/861636#M11826</guid>
      <dc:creator>FlorianCADOZ</dc:creator>
      <dc:date>2016-03-24T16:17:06Z</dc:date>
    </item>
  </channel>
</rss>

