<?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 Change the Colors on a RasterStretchRenderer in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-the-colors-on-a/m-p/1007818#M71061</link>
    <description>&lt;P&gt;Aha! I had half a mind to update it to 4.17 when playing around with the code today. Thanks for finding out!&lt;/P&gt;</description>
    <pubDate>Tue, 08 Dec 2020 19:31:33 GMT</pubDate>
    <dc:creator>Gianna_BBSRC</dc:creator>
    <dc:date>2020-12-08T19:31:33Z</dc:date>
    <item>
      <title>How to Change the Colors on a RasterStretchRenderer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-the-colors-on-a/m-p/23588#M2060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I have an&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryLayer.html"&gt; ImageryLayer&lt;/A&gt; or &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryTileLayer.html"&gt;ImageryTileLayer &lt;/A&gt;in my ArcGIS JavaScript API map, how do I change the colors of the renderer. Is it possible? I cannot get it to work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/ryansutc/pen/zYqzjjV?editors=1010"&gt;Here is a CodePen&lt;/A&gt; of what I've tried. Basically I'm trying to replace the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-RasterStretchRenderer.html#colorRamp"&gt;colorRamp&lt;/A&gt; with a new one and then update the renderer. This is basically a copy of an &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/layers-imagerytilelayer/index.html"&gt;ESRI sample &lt;/A&gt;that shows how you can change all other properties of the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-RasterStretchRenderer.html"&gt;RasterStretchRenderer &lt;/A&gt;on a LERC-based Raster layer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assumed that this was possible as you can change colors and complete styles for SimpleRenderers on vector data. I haven't yet looked at other types of Renderers to see what happens there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hoping I don't have to create a new layer. I'd like avoid requiring the client from having to pull all the data down each time the renderer is changed.&lt;/P&gt;&lt;P&gt;Thoughts advice are welcome.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ryan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 29 Aug 2020 23:23:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-the-colors-on-a/m-p/23588#M2060</guid>
      <dc:creator>RyanSutcliffe</dc:creator>
      <dc:date>2020-08-29T23:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to Change the Colors on a RasterStretchRenderer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-the-colors-on-a/m-p/23589#M2061</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ryan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's because you haven't assigned an initial renderer to your layer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;// create initial renderer&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;let&lt;/SPAN&gt; layerRenderer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;RasterStretchRenderer&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    colorRamp&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; colorRamp&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
    stretchType&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; stretchType
&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="comment token"&gt;// create a ImageryTileLayer from tiled elevation service&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;const&lt;/SPAN&gt; layer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;ImageryTileLayer&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    url&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"https://sampleserver6.arcgisonline.com/arcgis/rest/services/Elevation/MtBaldy_Elevation/ImageServer"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
    opacity&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0.9&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
    renderer&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; layerRenderer
&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;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Without it, there's nothing to clone in your &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;updateRenderer&lt;/SPAN&gt; function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 20:57:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-the-colors-on-a/m-p/23589#M2061</guid>
      <dc:creator>Gianna_BBSRC</dc:creator>
      <dc:date>2021-12-10T20:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to Change the Colors on a RasterStretchRenderer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-the-colors-on-a/m-p/1007604#M71043</link>
      <description>&lt;P&gt;Thanks for your post &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/196530"&gt;@Gianna_BBSRC&lt;/a&gt;. Apologies for my delayed response here-- didn't see this come into my inbox. Your post is correct and solves at least part of my problem.&amp;nbsp; Here is a &lt;A href="https://codepen.io/ryansutc/pen/VwKjQMO" target="_self"&gt;new code pen&lt;/A&gt; with that fix applied (as I understand it). Note though, that now the symbology &lt;STRONG&gt;only changes if you zoom or pan&lt;/STRONG&gt; and the original symbology hangs around on the existing tiles? Let me know if you or anyone spots anything wrong looking there.&lt;/P&gt;&lt;P&gt;In my apps I think I've mostly opted to completely reload the layer if I want to change a property like the colorRamp for a renderer to get around this but if there was a way to not need doing that it would be ideal.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 05:44:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-the-colors-on-a/m-p/1007604#M71043</guid>
      <dc:creator>RyanSutcliffe</dc:creator>
      <dc:date>2020-12-08T05:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to Change the Colors on a RasterStretchRenderer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-the-colors-on-a/m-p/1007690#M71051</link>
      <description>&lt;P&gt;Hi Ryan,&lt;/P&gt;&lt;P&gt;This looks like a bug to me. It seems like a caching issue with the tiles. I cleared my browser's cache and selected 'green' before the map loaded completely and got this (without zooming):&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Giannalogy_0-1607436576133.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/1681iFBB710BEA9B0D752/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Giannalogy_0-1607436576133.png" alt="Giannalogy_0-1607436576133.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I've scripted a few website using a regular &lt;A title="ImageryLayer" href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryLayer.html" target="_blank" rel="noopener"&gt;ImageryLayer&lt;/A&gt;, not &lt;A title="ImageryTileLayer" href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-ImageryTileLayer.html" target="_blank" rel="noopener"&gt;ImageryTileLayer&lt;/A&gt;, and it updates the renderer automatically. It may be worth raising a new question, or bug report with Esri, to get an answer for this one.&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Gianna&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 14:12:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-the-colors-on-a/m-p/1007690#M71051</guid>
      <dc:creator>Gianna_BBSRC</dc:creator>
      <dc:date>2020-12-08T14:12:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to Change the Colors on a RasterStretchRenderer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-the-colors-on-a/m-p/1007768#M71056</link>
      <description>&lt;P&gt;Thanks, I will reach out to ESRI Support and post back here any resolution.&amp;nbsp; As a bit of an aside, there were a few related issue we encountered with changing clientside renderers (not specifically RasterStretchRenderers) on ImageryLayer and other layer types as well. In various circumstances the old styles would hang around. Here is a&lt;A href="https://codepen.io/ryansutc/pen/gOwMvGp" target="_self"&gt; CodePen of one such case&lt;/A&gt; (don't think we ever got this one acknowledged as a bug). Another case that was, I think eventually acknowledged as a bug, was one where if you set up a featurelayer with a certain type of render and definitionExpression but changed it before drawing the layer, the API would insist on fetching and drawing the layer twice (&lt;A href="https://codepen.io/ryansutc/pen/Exgyzab" target="_self"&gt;codepen sample&lt;/A&gt;, &lt;A href="https://3vg-my.sharepoint.com/:v:/g/personal/rsutcliffe_3vgeomatics_com/ERtRgocF1cBDnfVBiAPorukBCRs9CksHWjFN5yfDStqiow?e=PnbScK" target="_self"&gt;video demo&lt;/A&gt;).&amp;nbsp;&lt;/P&gt;&lt;P&gt;All this is to say why we chose to just reload layers in these circumstances.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 17:17:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-the-colors-on-a/m-p/1007768#M71056</guid>
      <dc:creator>RyanSutcliffe</dc:creator>
      <dc:date>2020-12-08T17:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to Change the Colors on a RasterStretchRenderer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-the-colors-on-a/m-p/1007817#M71060</link>
      <description>&lt;P&gt;Got a prompt response from an ESRI Canada's support rep who pointed that the behaviour has been fixed at A&lt;STRONG&gt;rcGIS JavaScript API 4.17&lt;/STRONG&gt;. If you update the above codepen url links to 4.17 you'll see that the caching issue discussed is no longer an issue.&lt;/P&gt;&lt;P&gt;Given that, going to mark &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/196530"&gt;@Gianna_BBSRC&lt;/a&gt; 's answer as correct. Just remember to &lt;STRONG&gt;use 4.17 or higher&lt;/STRONG&gt;.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 19:28:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-the-colors-on-a/m-p/1007817#M71060</guid>
      <dc:creator>RyanSutcliffe</dc:creator>
      <dc:date>2020-12-08T19:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to Change the Colors on a RasterStretchRenderer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-the-colors-on-a/m-p/1007818#M71061</link>
      <description>&lt;P&gt;Aha! I had half a mind to update it to 4.17 when playing around with the code today. Thanks for finding out!&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 19:31:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-change-the-colors-on-a/m-p/1007818#M71061</guid>
      <dc:creator>Gianna_BBSRC</dc:creator>
      <dc:date>2020-12-08T19:31:33Z</dc:date>
    </item>
  </channel>
</rss>

