Is it the case that colormap raster functions can only render pixel values in the range of 0-255?

270
5
Jump to solution
02-21-2024 06:49 PM
Lerman
by
Occasional Contributor

Hello Everyone,

Is it the case that colormap raster functions can only render pixel values in the range of 0-255 for raster data? My test results suggest so, as there is no change even when modifying the outputPixelType parameter. I have created a demo to illustrate this, please see: https://codepen.io/xiej/pen/qBvGmMQ?editors=1000 . In this demo, raster values greater than 255 are not displayed. You can click the mouse on the map to view the pixel values at different locations.

This test outcome is beyond my expectations, and I believe colormap raster functions should not be limited to the 0-255 value range.

Thank you so much!

0 Kudos
1 Solution

Accepted Solutions
JohnGrayson
Esri Regular Contributor

Try setting an appropriate stretch before applying a colomap:

https://codepen.io/john-grayson/pen/WNmqZbq

View solution in original post

5 Replies
JohnGrayson
Esri Regular Contributor

Try setting an appropriate stretch before applying a colomap:

https://codepen.io/john-grayson/pen/WNmqZbq

Lerman
by
Occasional Contributor

Thanks @JohnGrayson , the data can be displayed now, but the problem after applying the stretch is that the legend makes no sense.

0 Kudos
JohnGrayson
Esri Regular Contributor

If the stretch raster function is not going to be used  conjunction with other raster functions to provide additional context to the processing of the pixels, then you might instead just use a stretch renderer if all you need is visualization. I've updated the CodePen to show this simpler alternative.

Lerman
by
Occasional Contributor


Okay, thank you very much @JohnGrayson . The solution I provided to my end-users also involves using renderer. However, I am puzzled why raster functions cannot be applied to rasters with pixel values above 255. Maybe it's designed this way, but I couldn't find any documentation explaining it.

0 Kudos
Lerman
by
Occasional Contributor

HI, @JohnGrayson . The ESRI Support Analyst told me that this is the expected behavior, that is, the colormap only maps pixel values from 0-255. Please see: https://support.esri.com/en-us/bug/the-colormap-to-rgb-raster-function-produces-raster-wit-bug-00011... . Thank you very much for the solution you provided!

0 Kudos