<?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: How to add features to a feature Layer in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-features-to-a-feature-layer/m-p/269111#M24788</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How about creating your &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/fl_featurecollection.html"&gt;feature layer from a feature collection&lt;/A&gt;&lt;SPAN&gt; and then using applyEdits to push your features from the find task into your feature layer?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm suggesting the feature collection route because if you were to use applyEdits with a feature layer created from a URL, the feature layer will try to push those features back to the server.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Apr 2012 18:30:21 GMT</pubDate>
    <dc:creator>derekswingley1</dc:creator>
    <dc:date>2012-04-13T18:30:21Z</dc:date>
    <item>
      <title>How to add features to a feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-features-to-a-feature-layer/m-p/269110#M24787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You would think this would be easy.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I want to manually add features&amp;nbsp; (from results of a FindTask) to my feature layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All examples in the help add such results as graphics directly to the Map [with map.graphics.add() ].&amp;nbsp; But I would like to add them to one of my FeatureLayers.&amp;nbsp; [esri.layers.FeatureLayer[myFeatureLayer].graphics]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is what the help does (which I dont want to do) &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
&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; var items = dojo.forEach(results,function(rslt){
&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; var desc = "&amp;lt;p&amp;gt;Name :"+rslt.attributes.TITLE+"&amp;lt;br&amp;gt;State:&amp;lt;/p&amp;gt;";
&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; var graphic = rslt;
&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; graphic.setSymbol(defaultSymbol);
&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; graphic.setInfoTemplate(infoTemplate);
&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; 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;&amp;nbsp;&amp;nbsp;&amp;nbsp; return rslt.attributes;
&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;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is what I want to do.&amp;nbsp; The features are added, but they do not display on the map even if I call .refresh() or readd the featureLayer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
&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; var items = dojo.map(results,function(rslt){
&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; return rslt.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;&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; myFeatureLayer.graphics = items;
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this not possible?&amp;nbsp; It seems to me that adding features/graphics to a featureLayer is more flexible than just adding them roguely to the map.&amp;nbsp; Can they only be added with featureLayer.selectFeatures() or at creation of the new FeatureLayer?&amp;nbsp;&amp;nbsp;&amp;nbsp; I would like to add my featureLayer with MODE_SELECTION so nothing is fetched from the server, and then query the server with a FindTask and then add the results to my feature Layer.&amp;nbsp; I know how to do it with a .selectFeatues(query)&amp;nbsp; but I want to do it with a findTask not a query.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Apr 2012 17:52:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-features-to-a-feature-layer/m-p/269110#M24787</guid>
      <dc:creator>lanceweaver</dc:creator>
      <dc:date>2012-04-13T17:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to add features to a feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-features-to-a-feature-layer/m-p/269111#M24788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How about creating your &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/fl_featurecollection.html"&gt;feature layer from a feature collection&lt;/A&gt;&lt;SPAN&gt; and then using applyEdits to push your features from the find task into your feature layer?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm suggesting the feature collection route because if you were to use applyEdits with a feature layer created from a URL, the feature layer will try to push those features back to the server.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Apr 2012 18:30:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-features-to-a-feature-layer/m-p/269111#M24788</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2012-04-13T18:30:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to add features to a feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-features-to-a-feature-layer/m-p/269112#M24789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Basically, you can do as example shows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;featureLayer.add(graphic);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So if items in your code is array of esri graphics, then:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for(var i in items){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; myFeatureLayer.add(items&lt;I&gt;);&lt;/I&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2012 10:30:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-features-to-a-feature-layer/m-p/269112#M24789</guid>
      <dc:creator>MihkelOviir</dc:creator>
      <dc:date>2012-05-23T10:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to add features to a feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-features-to-a-feature-layer/m-p/269113#M24790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;.add() is not a supported method for the featureLayer Class.&amp;nbsp;&amp;nbsp; see &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/featurelayer.htm"&gt;http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/featurelayer.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The response above is the correct one.&amp;nbsp;&amp;nbsp; The feature collection is exactly for this purpose, it is a featureLayer designed to add features to manually. I did not realize this when i made the post.&amp;nbsp;&amp;nbsp; It has essentially all the same methods, properties and events as a featureLayer.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2012 12:53:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-features-to-a-feature-layer/m-p/269113#M24790</guid>
      <dc:creator>lanceweaver</dc:creator>
      <dc:date>2012-05-23T12:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to add features to a feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-features-to-a-feature-layer/m-p/269114#M24791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Where it says, that add() is not supported? Look at featureLayer hierarchy. Do you want to say, that hide() and show() and all others useful parents layers methods is not supported also? Maybe, but I still use them...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2012 13:06:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-features-to-a-feature-layer/m-p/269114#M24791</guid>
      <dc:creator>MihkelOviir</dc:creator>
      <dc:date>2012-05-23T13:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to add features to a feature Layer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-features-to-a-feature-layer/m-p/269115#M24792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;my bad.&amp;nbsp; .add() can be used on all graphic layer classes.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2012 13:13:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-add-features-to-a-feature-layer/m-p/269115#M24792</guid>
      <dc:creator>lanceweaver</dc:creator>
      <dc:date>2012-05-23T13:13:12Z</dc:date>
    </item>
  </channel>
</rss>

