//Define the values of the three color channels using free expressions{"name":"name",//name of the style"fill": {"type":"channelMap",//must be channelMap"channelMap": [ {"expression":"band3",//An expression giving the value of the particular color channel"channel":"red",//The color channel to place the expression outcome in }, {"expression":"band2",//An expression giving the value of the particular color channel"channel":"green",//The color channel to place the expression outcome in }, {"expression":"band1",//An expression giving the value of the particular color channel"channel":"blue",//The color channel to place the expression outcome in } ], },"alphaMultiplier":1,//A float between 0 and 1 to fade the image"alpha":null,//An alpha object documented below"noData":null,//A noData object documented below"shade":null//A shade object documented below}
//Define conditions and assign colors based on those conditions {"name":"name",//name of the style"fill": {"type":"caseMap",//must be caseMap"defaultTarget":{"color":"#FFE733"},//Color to assign if all conditions evaluate false"caseMap": [ {"expression":"band1>0",//An expression to evaluate"target": {"color":"#2A5C84"},//The color to assign if the expression evaluates true"label":"label"//An optional label to use in the legend }, {"expression":"band1>1",//An expression to evaluate"target": {"color":"#74AE56"},//The color to assign if the exxpression evaluates true"label":"label"//An optional label to use in the legend }, {"expression":"and(band1>2, band2<0 )",//An expression to evaluate"target": {"color":"#ED2938"},//The color to assign if the expression evaluates true"label":"label"//An optional label to use in the legend } ], },"alphaMultiplier":1,//A float between 0 and 1 to fade the image"alpha":null,//An alpha object documented below"noData":null,//A noData object documented below"shade":null//A shade object documented below}
//Define an expression and sent the result to a color using ranges. {"name":"name",//name of the style"fill": {"type":"rangeMap",//must be rangeMap"expression":"2*band1+5",//An expression whose output to apply the rangeMap to"gradient":true,//A boolean indicating whether the color shoud fade from one range to the other"rangeMap": [ {"value":1,//Start of the range"target": {"color":"#2A5C84"},//The color to assign if the output of the expression falls in this range"label":"label"//An optional label to use in the legend }, {"value":2,//Start of the range"target": {"color":"#74AE56"},//The color to assign if the output of the expression falls in this range"label":"label"//An optional label to use in the legend }, {"value":3,//Start of the range"target": {"color":"#ED2938"},//The color to assign if the output of the expression falls in this range"label":"label"//An optional label to use in the legend } ], },"alphaMultiplier":1,//A float between 0 and 1 to fade the image"alpha":null,//An alpha object documented below"noData":null,//A noData object documented below"shade":null//A shade object documented below}
//Define an expression and sent the result to a color based on a value to color map{"name":"name",//name of the style"fill": {"type":"valueMap",//must be valueMap"expression":"2*band1+5",//An expression whose output to apply the valueMap to"defaultTarget":"#FFE733",//Color to assing if the output of the expression does not match any of the values in the valueMap"rangeMap": [ {"value":1,//Value to sent to the specific color. Must be integer"target": {"color":"#2A5C84"},//The color to assign if the output equals the given value"label":"label"//An optional label to use in the legend }, {"value":2,//Value to sent to the specific color. Must be integer"target": {"color":"#74AE56"},//The color to assign if the output equals the given value"label":"label"//An optional label to use in the legend }, {"value":3,//Value to sent to the specific color. Must be integer"target": {"color":"#ED2938"},//The color to assign if the output equals the given value"label":"label"//An optional label to use in the legend } ], },"alphaMultiplier":1,//A float between 0 and 1 to fade the image"alpha":null,//An alpha object documented below"noData":null,//A noData object documented below"shade":null//A shade object documented below}
Expressions
An expression is a string containing an expression outputting either a number or boolean.
In the expression you can use raster values by referencing the band:
band1, band2, band3, ...
The expression can also contain standard operators such as:
*,+,-,/, floor(_),),(
Lastly one can use these logical operators
&&, ||, !, ==,<=,<,>,>=,!=
An expression can simply be the value of the band
expression = "band1"
Or an expression can simply be a value
expression="1"
Or boolean
expression="true"
An example of an expression rendering a number:
expression = "(band1^2+band2^2)^(1/2)"
An example of an expression rendering a boolean
expression = "!( band1 > 0 && band2>0)"
Alpha object
The Alpha object can have two types. Expression Map and caseMap
In case of type expression the result of the expression will be used as alpha value. Mind that the alpha value will be clipped to 0 and 1.