Upcoming raster styles

Description

Adds a raster style.

Endpoint

/path/{pathId}/raster/style

Method

POST

Access Level Rules

Minimum Access Level

edit+

Processing Units

Minimum processing units

2

Parameters

Name
Description
Required
Default

pathId

The id of the raster layer.

true

name

The name of the style to add.

true

parameters

The parameters for the style. See details below.

true

description

A description of the style as string.

false

Default null.

Sample requests for different methods

//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
}

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.

alpha={type:"expressionMap", expression: "5*band1/2"}

In case of type case, all expressions in the conditions are evaluated and the given value is assigned if the condition evaluates true.

alpha={"type":"caseMap", "caseMap":[{"expression": "and(band1>0, band1<1)" , "target":{"number":0.2}}, {"expression":"and(band1>1, band1<2)", "target":{"number":0.4}}] }

NoData

NoData should be an expression outputting a boolean. True will make the output pixel transparent, false will make it non transparent.

noData="or(band1<0, band2==0)"

Shade

Shade should be an object describing a hill shade.

shade={bandNumber:1, exaggerate:1, azimuth:90, factor:0.5, angle:45 }

The bandNumber tells which band of the raster to interpret as altitude.

The factor should be between 0 and 1 and describes the weight with which to blend the shade into the output.

The exaggerate is used to multiply the band with.

The angle and azimuth describe the position of the sun in degrees.

πŸ–ŒοΈRaster styling methods

Last updated