<?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: Is there a way to load/update the data without removing feature layer and without flicker effect using arcgis javascript api 4 in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-there-a-way-to-load-update-the-data-without/m-p/251115#M23270</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are updating data from an external source, you don't need to create a new layer each time. You can use the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdits" rel="nofollow noopener noreferrer" target="_blank"&gt;applyEdits&lt;/A&gt; of the FeatureLayer to make these changes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=layers-featurelayer-collection-edits" rel="nofollow noopener noreferrer" target="_blank"&gt;sample&lt;/A&gt; from the SDK that does this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a &lt;A href="https://codepen.io/odoe/pen/dyMpZPp?editors=0010" rel="nofollow noopener noreferrer" target="_blank"&gt;sample&lt;/A&gt; I put together that does the update every 5 seconds.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;    &lt;SPAN class="keyword token"&gt;const&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;features&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;await&lt;/SPAN&gt; layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;queryFeatures&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

    layer
      &lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;applyEdits&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
      addFeatures&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; graphics&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;// new updated features&lt;/SPAN&gt;
      deleteFeatures&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; features &lt;SPAN class="comment token"&gt;// delete the old features&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
      &lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;then&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;results&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
      console&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;log&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"features updated"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
      &lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;catch&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;err&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; console&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;warn&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;err&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This performs well without flashing of the client side layer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 12:27:31 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2021-12-11T12:27:31Z</dc:date>
    <item>
      <title>Is there a way to load/update the data without removing feature layer and without flicker effect using arcgis javascript api 4</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-there-a-way-to-load-update-the-data-without/m-p/251114#M23269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #242729; background-color: #ffffff; border: 0px; margin: 0px 0px 1em;"&gt;I am creating a feature layer from feature collection by fetching data from external query service and adding to the map.&lt;/P&gt;&lt;P style="color: #242729; background-color: #ffffff; border: 0px; margin: 0px 0px 1em;"&gt;As per my project need I have to re-fetch the data and add on the map after every 5 seconds. To achieve this I am requesting data using external query and after getting the response data(in JSON format) I am removing the previous feature layer and adding a new one.&lt;/P&gt;&lt;P style="color: #242729; background-color: #ffffff; border: 0px; margin: 0px 0px 1em;"&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;Issues&lt;/STRONG&gt;: While adding the new layer on the map it takes a little time (~1 sec) to reflect the feature on the map which looks like a flicker effect.&lt;/P&gt;&lt;P style="color: #242729; background-color: #ffffff; border: 0px; margin: 0px 0px 1em;"&gt;&lt;STRONG style="border: 0px; font-weight: bold;"&gt;Question&lt;/STRONG&gt;: Is there a way to load/update the data without removing feature layer and without flicker effect (only added/removed features should reflect on the map )&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Aug 2020 05:31:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-there-a-way-to-load-update-the-data-without/m-p/251114#M23269</guid>
      <dc:creator>ShefaliMantri</dc:creator>
      <dc:date>2020-08-19T05:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to load/update the data without removing feature layer and without flicker effect using arcgis javascript api 4</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-there-a-way-to-load-update-the-data-without/m-p/251115#M23270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are updating data from an external source, you don't need to create a new layer each time. You can use the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdits" rel="nofollow noopener noreferrer" target="_blank"&gt;applyEdits&lt;/A&gt; of the FeatureLayer to make these changes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=layers-featurelayer-collection-edits" rel="nofollow noopener noreferrer" target="_blank"&gt;sample&lt;/A&gt; from the SDK that does this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a &lt;A href="https://codepen.io/odoe/pen/dyMpZPp?editors=0010" rel="nofollow noopener noreferrer" target="_blank"&gt;sample&lt;/A&gt; I put together that does the update every 5 seconds.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;    &lt;SPAN class="keyword token"&gt;const&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;features&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;await&lt;/SPAN&gt; layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;queryFeatures&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

    layer
      &lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;applyEdits&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
      addFeatures&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; graphics&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;// new updated features&lt;/SPAN&gt;
      deleteFeatures&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; features &lt;SPAN class="comment token"&gt;// delete the old features&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
      &lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;then&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;results&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
      console&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;log&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"features updated"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
      &lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;catch&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;err&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt; console&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;warn&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;err&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This performs well without flashing of the client side layer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:27:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-there-a-way-to-load-update-the-data-without/m-p/251115#M23270</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-12-11T12:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to load/update the data without removing feature layer and without flicker effect using arcgis javascript api 4</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-there-a-way-to-load-update-the-data-without/m-p/251116#M23271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you. Project requirement is object id should not change for existing data.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #242729; background-color: #ffffff;"&gt;In the project, there is one list widget that is bind with that object id and first list widget create then update on the map.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #242729; background-color: #ffffff;"&gt;Currently when after apply edits result is as shown below&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #242729; background-color: #ffffff;"&gt;&lt;IMG __jive_id="504056" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/504056_pastedImage_2.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #242729; background-color: #ffffff;"&gt;As u can see the object is the same for all add features.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Object id value is not created dynamically. When we fetch data from external query service we have one unique field value which we use as a objectid value while creating feature layer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Aug 2020 05:48:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-there-a-way-to-load-update-the-data-without/m-p/251116#M23271</guid>
      <dc:creator>ShefaliMantri</dc:creator>
      <dc:date>2020-08-20T05:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to load/update the data without removing feature layer and without flicker effect using arcgis javascript api 4</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-there-a-way-to-load-update-the-data-without/m-p/251117#M23272</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can let the layer create the unique id field for you. Just give it a different name. If your unique field is numeric, you can use that if you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;    fields&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;
      &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
        name&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"FID"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
        alias&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"FID"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
        type&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"oid"&lt;/SPAN&gt;
      &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;You could call it UniqueID, that doesn't matter, we'll generate the ids for you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:27:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-there-a-way-to-load-update-the-data-without/m-p/251117#M23272</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-12-11T12:27:34Z</dc:date>
    </item>
  </channel>
</rss>

