<?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: Updating a GeoJSON layer that uses UniqueValueRenderer in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/updating-a-geojson-layer-that-uses/m-p/1350572#M82800</link>
    <description>&lt;P&gt;Update:&lt;/P&gt;&lt;P&gt;I've learned a bit since my post above and have found an acceptable solution. Usign applyEdits is the way to go, but I had to make some changes. I'm no longer using Query:&lt;/P&gt;&lt;P&gt;Here's the solution that appears to be working:&lt;/P&gt;&lt;P&gt;- load webmap&lt;BR /&gt;- send request for GeoJSON&lt;BR /&gt;- receive GeoJSON&lt;/P&gt;&lt;P&gt;on first data:&lt;BR /&gt;- create content blob&lt;BR /&gt;- create url reference to blob&lt;BR /&gt;- create GeoJSON layer&lt;BR /&gt;- layer.when():&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - create a uniqueValueRenderer instance&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - iterate Features (of GeoJSON)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - create a new simpleMarkerSymbol which is dependent on the Feature data&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - addUniqueValueInfo to the renderer&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - add renderer to the layer&lt;BR /&gt;- add the layer to the map&lt;BR /&gt;&lt;BR /&gt;on new data / refresh:&lt;BR /&gt;- create a new uniqueValueRenderer instance, graphics array&lt;BR /&gt;- iterate Features (of GeoJSON):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - create a new simpleMarkerSymbol which is dependent on the Feature data&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - addUniqueValueInfo to the renderer&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - add new Graphic to graphics array&lt;BR /&gt;- add renderer to the layer&lt;BR /&gt;- layer.applyEdits({updateFeatures:graphics});&lt;BR /&gt;&lt;BR /&gt;This sample was helpful in getting applyEdits to work:&lt;BR /&gt;&lt;A title="Sandbox Link" href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=layers-featurelayer-collection-edits " target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=layers-featurelayer-collection-edits &lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Nov 2023 23:40:05 GMT</pubDate>
    <dc:creator>EdMayer</dc:creator>
    <dc:date>2023-11-16T23:40:05Z</dc:date>
    <item>
      <title>Updating a GeoJSON layer that uses UniqueValueRenderer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/updating-a-geojson-layer-that-uses/m-p/1349942#M82778</link>
      <description>&lt;P&gt;Using version 4.28 of the maps SDK and looking for advice on best practice to update a GeoJSON layer that uses uniqueValueRenderer to create a custom simpleMarkerSymbol. Without providing the specific code, the program flow is as follows:&lt;/P&gt;&lt;P&gt;- load webmap&lt;BR /&gt;- send request for GeoJSON&lt;BR /&gt;- receive GeoJSON&lt;BR /&gt;- create content blob&lt;BR /&gt;- create url reference to blob&lt;BR /&gt;- create GeoJSON layer&lt;BR /&gt;- use query.queryFeatures() to fetch outfields&lt;BR /&gt;- create a uniqueValueRenderer instance&lt;BR /&gt;- iterate Features:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - create a new simpleMarkerSymbol which is dependent on the Feature data&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - addUniqueValueInfo to the renderer&lt;BR /&gt;- add the renderer to the layer&lt;BR /&gt;- add the layer to the map&lt;/P&gt;&lt;P&gt;At this point the layer is created and shows on the map as expected. The problem I'm having is, how to apply the changes to the existing layer when a new request/response is generated/received? Currently I'm removing the layer and adding it back, but that causes the layer to flash when replaced. Any recommended approaches for this scenario?&lt;/P&gt;&lt;P&gt;I've experimented with applyEdits-updateFeatures-Collection but haven't been successful in getting the layer to update.&lt;/P&gt;&lt;P&gt;Additionally, I feel like I'm using the uniqueValueRenderer as a workaround, and there may be a better solution to accomplish the goal of creating data-driven marker symbols that depend on the feature content (including an SVG path) which is contained in the feature data. Any comments are appreciated.&lt;/P&gt;&lt;P&gt;-Ed&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2023 20:26:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/updating-a-geojson-layer-that-uses/m-p/1349942#M82778</guid>
      <dc:creator>EdMayer</dc:creator>
      <dc:date>2023-11-15T20:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a GeoJSON layer that uses UniqueValueRenderer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/updating-a-geojson-layer-that-uses/m-p/1350022#M82781</link>
      <description>&lt;P&gt;I'm not sure I follow the scenario 100%, but it sounds like you could just use the smart mapping functions for this:&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-smartMapping-renderers-type.html#createRenderer" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-smartMapping-renderers-type.html#createRenderer&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The smart mapping functions generate renderers based on the underlying data. The createRenderer function for unique values works for all "feature layer-like" types, including GeoJSON. Here's an example:&amp;nbsp;&lt;A href="https://codepen.io/kekenes/pen/wvNPGXJ?editors=100" target="_blank"&gt;https://codepen.io/kekenes/pen/wvNPGXJ?editors=100&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2023 22:44:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/updating-a-geojson-layer-that-uses/m-p/1350022#M82781</guid>
      <dc:creator>KristianEkenes</dc:creator>
      <dc:date>2023-11-15T22:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a GeoJSON layer that uses UniqueValueRenderer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/updating-a-geojson-layer-that-uses/m-p/1350090#M82782</link>
      <description>&lt;P&gt;Thanks Kristian.&amp;nbsp; I had been looking at the smartMapping renderers just prior to posting.&amp;nbsp; It does appear to offer similar capability to what I'm doing with using the UniqueValueRenderer.&amp;nbsp; I hadn't seen that codepen, so thanks for that link also.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Nov 2023 00:47:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/updating-a-geojson-layer-that-uses/m-p/1350090#M82782</guid>
      <dc:creator>EdMayer</dc:creator>
      <dc:date>2023-11-16T00:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: Updating a GeoJSON layer that uses UniqueValueRenderer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/updating-a-geojson-layer-that-uses/m-p/1350572#M82800</link>
      <description>&lt;P&gt;Update:&lt;/P&gt;&lt;P&gt;I've learned a bit since my post above and have found an acceptable solution. Usign applyEdits is the way to go, but I had to make some changes. I'm no longer using Query:&lt;/P&gt;&lt;P&gt;Here's the solution that appears to be working:&lt;/P&gt;&lt;P&gt;- load webmap&lt;BR /&gt;- send request for GeoJSON&lt;BR /&gt;- receive GeoJSON&lt;/P&gt;&lt;P&gt;on first data:&lt;BR /&gt;- create content blob&lt;BR /&gt;- create url reference to blob&lt;BR /&gt;- create GeoJSON layer&lt;BR /&gt;- layer.when():&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - create a uniqueValueRenderer instance&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - iterate Features (of GeoJSON)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - create a new simpleMarkerSymbol which is dependent on the Feature data&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - addUniqueValueInfo to the renderer&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - add renderer to the layer&lt;BR /&gt;- add the layer to the map&lt;BR /&gt;&lt;BR /&gt;on new data / refresh:&lt;BR /&gt;- create a new uniqueValueRenderer instance, graphics array&lt;BR /&gt;- iterate Features (of GeoJSON):&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - create a new simpleMarkerSymbol which is dependent on the Feature data&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - addUniqueValueInfo to the renderer&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; - add new Graphic to graphics array&lt;BR /&gt;- add renderer to the layer&lt;BR /&gt;- layer.applyEdits({updateFeatures:graphics});&lt;BR /&gt;&lt;BR /&gt;This sample was helpful in getting applyEdits to work:&lt;BR /&gt;&lt;A title="Sandbox Link" href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=layers-featurelayer-collection-edits " target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=layers-featurelayer-collection-edits &lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Nov 2023 23:40:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/updating-a-geojson-layer-that-uses/m-p/1350572#M82800</guid>
      <dc:creator>EdMayer</dc:creator>
      <dc:date>2023-11-16T23:40:05Z</dc:date>
    </item>
  </channel>
</rss>

