<?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: Cannot apply UniqueValueRenderer to ImageryLayer at ArcGIS JavaScript API 4.18+ in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cannot-apply-uniquevaluerenderer-to-imagerylayer/m-p/1062400#M73301</link>
    <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;The original issue (where&amp;nbsp;&lt;SPAN&gt;a client side remap raster function with unique value renderer was reverting to default) is fixed at 4.20. The version 4.20 is expected to be released end of June.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;We relaxed the internal checks to allow setting unique value renderer on top of raster functions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In your app you need to do couple of changes to get it working. &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Set the renderer field&lt;/LI&gt;&lt;LI&gt;Set the pixel type for the raster function.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I updated your test app to use the `next` version of the api that show cases the fix:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://codepen.io/U_B_U/pen/mdWeaor?editors=1000" rel="nofollow" target="_blank"&gt;https://codepen.io/U_B_U/pen/mdWeaor?editors=1000&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will take a look at this issue:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-api-for-javascript/cannot-apply-uniquevaluerenderer-to-imagerylayer-at-arcgis/m-p/1059167/highlight/true#M73169" target="_blank"&gt;https://community.esri.com/t5/arcgis-api-for-javascript/cannot-apply-uniquevaluerenderer-to-imagerylayer-at-arcgis/m-p/1059167/highlight/true#M73169&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Undral&lt;/P&gt;</description>
    <pubDate>Thu, 27 May 2021 16:17:02 GMT</pubDate>
    <dc:creator>UndralBatsukh</dc:creator>
    <dc:date>2021-05-27T16:17:02Z</dc:date>
    <item>
      <title>Cannot apply UniqueValueRenderer to ImageryLayer at ArcGIS JavaScript API 4.18+</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cannot-apply-uniquevaluerenderer-to-imagerylayer/m-p/1056484#M73033</link>
      <description>&lt;P&gt;At 4.18, we are no longer able to successfully render our ImageryLayers with a UniqueValueRenderer. Here is the gist of what we used to do successfully at 4.17 and earlier:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;// Raster functions
  var extractRF = new RasterFunction({
    functionName: "ExtractBand",
    functionArguments: {
      bandIds: [0]   // lets say we want 1st band
    },
    variableName: "Raster"
  });

  var remapRF = new RasterFunction({
    functionName: "Remap",
    functionArguments: {
      inputRanges: [0, 255], // get all vals
      outputValues: [1], //set them all to 1
      raster: extractRF,
      AllowUnmatched: true
    }
  });

  const newRaster = new ImageryLayer({
    url: [my raster url here],
    renderingRule: remapRF,
    renderer: new UniqueValueRenderer({ 
      type: "unique-value",
      uniqueValueInfos: [{
        value: 1,   // take values of 1 and symbolize them
        label: " ",
        symbol: {
          type: "simple-fill",
          color: "black"
        }
      }]
    })
  });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But this no longer works at 4.18 and 4.19. Here is a&lt;A title="Example in CodePen" href="https://codepen.io/ryansutc/pen/ZEebpXj?editors=1000" target="_self"&gt; codepen showing the problem&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A warning in the console says:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;[esri.layers.mixins.ArcGISImageService] ArcGISImageService Switching to the default renderer. Renderer applied is not valid for this Imagery Layer&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;But I don't see anything in 4.18 indicating any breaking changes and docs still say &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-UniqueValueRenderer.html" target="_self"&gt;UniqueValuesRenderer&lt;/A&gt; works fine on &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryLayer.html#renderer" target="_self"&gt;ImageryLayers&lt;/A&gt;. Anyone know what the fix might be?&lt;/P&gt;</description>
      <pubDate>Mon, 10 May 2021 23:12:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cannot-apply-uniquevaluerenderer-to-imagerylayer/m-p/1056484#M73033</guid>
      <dc:creator>RyanSutcliffe</dc:creator>
      <dc:date>2021-05-10T23:12:49Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot apply UniqueValueRenderer to ImageryLayer at ArcGIS JavaScript API 4.18+</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cannot-apply-uniquevaluerenderer-to-imagerylayer/m-p/1058594#M73131</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are able to reproduce the issue you described. Thank you very much for the reproducible case. I will update you as soon as we install a fix for this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;In meantime, if it is acceptable you can use the `Colormap` raster function as a &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryLayer.html#renderingRule" target="_self"&gt;ImageryLayer.renderingRule&lt;/A&gt; for a workaround. This &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=layers-imagery-renderingrule" target="_self"&gt;sdk sample&lt;/A&gt; shows how to use it.&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks,&lt;/DIV&gt;&lt;DIV&gt;-Undral&lt;/DIV&gt;</description>
      <pubDate>Mon, 17 May 2021 16:21:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cannot-apply-uniquevaluerenderer-to-imagerylayer/m-p/1058594#M73131</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2021-05-17T16:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot apply UniqueValueRenderer to ImageryLayer at ArcGIS JavaScript API 4.18+</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cannot-apply-uniquevaluerenderer-to-imagerylayer/m-p/1059167#M73169</link>
      <description>&lt;P&gt;Your workaround works (new fixed&amp;nbsp;&lt;A href="https://codepen.io/ryansutc/pen/LYWbVPm?editors=1000" target="_self"&gt;codepen example here&lt;/A&gt;). However I am finding if I switch the example 2-band Raster ImageService with a 3-band one, the legend shows the generic 3-band image:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RyanSutcliffe_0-1621370723123.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/13569iA2DBB83468253668/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RyanSutcliffe_0-1621370723123.png" alt="RyanSutcliffe_0-1621370723123.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I don't think there is anything different between my 3-band and the public 2-band raster from ESRI used in the codepen but I cannot find a publicly available 3-band example to share. This isn't a show-stopper so I'll leave solution as accepted but any insights are of course welcome.&lt;/P&gt;</description>
      <pubDate>Tue, 18 May 2021 20:48:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cannot-apply-uniquevaluerenderer-to-imagerylayer/m-p/1059167#M73169</guid>
      <dc:creator>RyanSutcliffe</dc:creator>
      <dc:date>2021-05-18T20:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot apply UniqueValueRenderer to ImageryLayer at ArcGIS JavaScript API 4.18+</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cannot-apply-uniquevaluerenderer-to-imagerylayer/m-p/1062400#M73301</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;The original issue (where&amp;nbsp;&lt;SPAN&gt;a client side remap raster function with unique value renderer was reverting to default) is fixed at 4.20. The version 4.20 is expected to be released end of June.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;We relaxed the internal checks to allow setting unique value renderer on top of raster functions.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In your app you need to do couple of changes to get it working. &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Set the renderer field&lt;/LI&gt;&lt;LI&gt;Set the pixel type for the raster function.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I updated your test app to use the `next` version of the api that show cases the fix:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://codepen.io/U_B_U/pen/mdWeaor?editors=1000" rel="nofollow" target="_blank"&gt;https://codepen.io/U_B_U/pen/mdWeaor?editors=1000&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will take a look at this issue:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-api-for-javascript/cannot-apply-uniquevaluerenderer-to-imagerylayer-at-arcgis/m-p/1059167/highlight/true#M73169" target="_blank"&gt;https://community.esri.com/t5/arcgis-api-for-javascript/cannot-apply-uniquevaluerenderer-to-imagerylayer-at-arcgis/m-p/1059167/highlight/true#M73169&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Undral&lt;/P&gt;</description>
      <pubDate>Thu, 27 May 2021 16:17:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cannot-apply-uniquevaluerenderer-to-imagerylayer/m-p/1062400#M73301</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2021-05-27T16:17:02Z</dc:date>
    </item>
  </channel>
</rss>

