Setting negative raster values to 0
In some cases you might want to clean up a raster layer and replace certain values with another value. A a common example is having a NDSM with <0 values that you want to replace with "0".
You can use the "layer arithmetics" algorithm, to set all values <0 to 0. This will create a new temporary layer which then can be used for the consecutive processes. Here are two approaches to tackle this.
- Here are the settings to set values below 0 to 0 for "Layer 1" and keep all other values as they are! The output layer created is as mentioned before a temporary layer in this case called "arithmetics". The range between the minimum (yellow) and maximum (blue) value define the values that you want to re-assign. By default this is set to zero (Output value). Make sure that the "output layer type" is the same bit depth as the input.
- There is another more elegant way to solve your issue with the "layer arithmetics" algorithm.
"(Layer 1 > 0)*Layer 1" is the key here. If the value of Layer one is greater than 0 (it gets the value 1 because it is true) multiply it with Layer 1. All other values are multiplied by 0 (not greater than zero and therefore get set to zero.
Interesting related content:
- Project & Rule Set Examples: Layer Arithmetics
- eCognition Deconstructed video: Layer Arithmetics
Was this article helpful?