<div dir="ltr"><div>Hello,<br><br></div>We have maps where we want the color scale go from e.g. 10 to 20, so we are using this directive:<br><div><br><span style="font-family:monospace">PROCESSING "SCALE_1=10.0,20.0" </span><br><br></div><div>This works great by itself, however it also means that pixels with values of e.g. 5 are rendered as transparent, which is the same as the nodata pixels. So in the final image, you can't tell if data is present but the values are too low, or if there just isn't any data.<br><br></div><div>So the behaviour we would like is that values below 10 are rendered as black and values over 20 are rendered as white.<br><br></div><div>Is this somehow possible with mapscript?<br><br><br>We tried to have a look in the source code, and there is this line, which effectively assigns 0 to pixels below the minimum:<br><a href="https://github.com/MapServer/MapServer/blob/main/mapdrawgdal.c#L1555">https://github.com/MapServer/MapServer/blob/main/mapdrawgdal.c#L1555</a></div><div><br></div><div>It turns out that this small code change actually produces the desired behavior:<br></div><div><pre class="gmail-code gmail-highlight gmail-js-syntax-highlight gmail-language-plaintext gmail-solarized-dark" id="gmail-code-7" lang="plaintext"><code><span class="gmail-line" id="gmail-LC1" lang="plaintext">       fScaledValue = (float) ((pafRawData[i]-dfScaleMin)*dfScaleRatio);</span>
<span class="gmail-line" id="gmail-LC2" lang="plaintext"> </span>
<span class="gmail-line" id="gmail-LC3" lang="plaintext">       if( fScaledValue < 0.0 )</span>
<span class="gmail-line" id="gmail-LC4" lang="plaintext">-        pabyBuffer[i] = 0;</span>
<span class="gmail-line" id="gmail-LC5" lang="plaintext">+        if (pafRawData[i] > 0) {</span>
<span class="gmail-line" id="gmail-LC6" lang="plaintext">+            pabyBuffer[i] = 1;</span>
<span class="gmail-line" id="gmail-LC7" lang="plaintext">+        } else {</span>
<span class="gmail-line" id="gmail-LC8" lang="plaintext">+            pabyBuffer[i] = 0;</span>
<span class="gmail-line" id="gmail-LC9" lang="plaintext">+        }<br><br></span></code></pre><pre class="gmail-code gmail-highlight gmail-js-syntax-highlight gmail-language-plaintext gmail-solarized-dark" id="gmail-code-7" lang="plaintext"><code><span class="gmail-line" id="gmail-LC9" lang="plaintext"><font face="arial,sans-serif">(I.e. if the original value was greater than 0, then assign 1 to this pixel such that it will be black and not transparent.)<br><br></font></span></code></pre><pre class="gmail-code gmail-highlight gmail-js-syntax-highlight gmail-language-plaintext gmail-solarized-dark" id="gmail-code-7" lang="plaintext"><code><span class="gmail-line" id="gmail-LC9" lang="plaintext"><span style="font-family:arial,sans-serif">If this behavior can't yet be configured via mapscript, we could work on a pull request to implement this behavior, which would then be activated via a new configuration option.<br>Do you have any thoughts on this? Does this make sense to you as a feature?<br><br></span></span></code></pre><pre class="gmail-code gmail-highlight gmail-js-syntax-highlight gmail-language-plaintext gmail-solarized-dark" id="gmail-code-7" lang="plaintext"><code><span class="gmail-line" id="gmail-LC9" lang="plaintext"><span style="font-family:arial,sans-serif">Best regards,<br>Bernhard</span><br></span></code></pre></div></div>