<?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 Updating FeatureLayer with features being added or removed in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/updating-featurelayer-with-features-being-added-or/m-p/1202613#M78278</link>
    <description>&lt;P&gt;I am trying to figure out the most efficient way to manipulate features on the FeatureLayer. Specifically:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If feature not on layer - add it&lt;/LI&gt;&lt;LI&gt;If feature on layer already - ignore it&lt;/LI&gt;&lt;LI&gt;If feature on layer but not in feature list - remove it&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function GetFeatures(data: Features[]) {
var polygonFeatures = data.filter(e =&amp;gt; e.isPolygon);
var pointFeatures = data.filter(e =&amp;gt; e.isPoint);

this.polygonFeatureLayer?.queryFeatures({ where: "id NOT IN (" + polygonFeatures .map(x =&amp;gt; { return "'" + x.id + "'" }) + ")" })
      .then((results) =&amp;gt; this.polygonFeatureLayer?.applyEdits({ deleteFeatures: results.features }));

this.polygonFeatureLayer?.applyEdits({addFeatures: convertFeaturesToFormat(polygonFeatures)});
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am about to put together a function for omitting features so it doesn't duplicate them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the most efficient way to do the above?&lt;/P&gt;</description>
    <pubDate>Sat, 13 Aug 2022 04:30:18 GMT</pubDate>
    <dc:creator>Aeseir</dc:creator>
    <dc:date>2022-08-13T04:30:18Z</dc:date>
    <item>
      <title>Updating FeatureLayer with features being added or removed</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/updating-featurelayer-with-features-being-added-or/m-p/1202613#M78278</link>
      <description>&lt;P&gt;I am trying to figure out the most efficient way to manipulate features on the FeatureLayer. Specifically:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If feature not on layer - add it&lt;/LI&gt;&lt;LI&gt;If feature on layer already - ignore it&lt;/LI&gt;&lt;LI&gt;If feature on layer but not in feature list - remove it&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function GetFeatures(data: Features[]) {
var polygonFeatures = data.filter(e =&amp;gt; e.isPolygon);
var pointFeatures = data.filter(e =&amp;gt; e.isPoint);

this.polygonFeatureLayer?.queryFeatures({ where: "id NOT IN (" + polygonFeatures .map(x =&amp;gt; { return "'" + x.id + "'" }) + ")" })
      .then((results) =&amp;gt; this.polygonFeatureLayer?.applyEdits({ deleteFeatures: results.features }));

this.polygonFeatureLayer?.applyEdits({addFeatures: convertFeaturesToFormat(polygonFeatures)});
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am about to put together a function for omitting features so it doesn't duplicate them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the most efficient way to do the above?&lt;/P&gt;</description>
      <pubDate>Sat, 13 Aug 2022 04:30:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/updating-featurelayer-with-features-being-added-or/m-p/1202613#M78278</guid>
      <dc:creator>Aeseir</dc:creator>
      <dc:date>2022-08-13T04:30:18Z</dc:date>
    </item>
  </channel>
</rss>

