Visualization in evalScript with WCSrequest Python

I have a couple of questions regarding visualization using the evalscripts of the layers in the configuration utility.

  1. I would like to create a relative visualization colormap. I have been searching for a function here but I couldn’t find any suitable to take the max and min value of a specific index inside a region and stretch the color of the map to those values. In all examples I read it’s always needed to set a min and max value to stretch the data.

  2. I would like to send input data to an evalscript or add a piece of another evalscript to complete the one at the layers in the configuration utility in order to make it more flexible for different user needs in specific layers.

I can try to provide examples or explain myself better if needed.


Hi Sam, thanks for the questions;

  1. To answer your first question, we don’t offer dynamic stretching within the relative visualisation colormap function. You are always required to define the minimum and maximum value of the data range.

  2. I am not sure what exactly you are asking in your second question. However, you can combine functions together within your evalscript. There are several examples of this in the custom scripts repository, for instance, in this one there are several functions defined that are then used in the EvaluatePixel() function. If you’re able to explain in more detail then we can help give you a more definitive answer.

Hi, William.
Just by combining both questions could be more easy to understand everything.
Is it possible to do a work around in order to achieve this with just the evalscript, any function to min/max values in order to stretch the palette to them?
If not was thinking that would be possible to create first a Statistical request to get max and min parameters and use them in the evalscript as input parameter to the evalscript like globals, not for a function inside the evalscript.
To try to clarify it a little bit more:
I have adapted a custom evalscript.


let min = -0.6;
let max = 0.5;
let zero = 0.0;

function setup() {
  return {
    input: ["B02", "B03", "B04", "dataMask"],
    output: { 
		bands: 4
function evaluatePixel(sample){
	let underflow_color = [1, 1, 1, sample.dataMask];
	let low_color = [208/255, 88/255, 126/255, sample.dataMask];
	let high_color = [241/255, 234/255, 200/255, sample.dataMask];
	let zero_color = [0, 147/255, 146/255, sample.dataMask];

	let index = 0.1509 * sample.B02 + 0.1973 * sample.B03 + 0.3279 * sample.B04 

	return valueInterpolate(index, [min, min, zero, max],
  1. It would be great to be able to calculate min and max values of let index for the specific geometry I send through the WcsRequest to adapt let min = -0.6; let max = 0.5;
  2. If 1 is not possible to send min and max values from the WcsRequest to the evalscript after a Statistical API calculation.

If none of those things are possible I am afraid i will need to do an adaptation of my second option storing and modifying the evalscripts of all the layers in Python, instead of using the ones in Configuration Utility.

Thanks again!

Hi Sam,

As I said dynamically calculating the minimum and maximum values of your visualisation by the geometry is not possible as these values are set in the evalscript in the Configuration Utility.

The only way to change the stretch is to do this manually changing the min and max values in the evalscript yourself. Of course, you can get those values from a Statistical API request.