Calculadora Raster

The Raster Calculator in the Raster menu (see figure_raster_2) allows to perform calculations on basis of existing raster pixel values. The results are written to a new raster layer with a GDAL supported format.

Figure Raster 2:

../../../_images/raster_calculator1.png

Raster Calculator nix

The Raster bands list contains all loaded raster layers that can be used. To add a raster to the raster calculator expression field, double click its name in the Fields list. You can then use the operators to construct calculation expressions or you can just type it into the box.

Na seção Result layer é necessário definir a camada de saída. Em seguida, pode definir a extensão da área de cálculo com base em uma camada raster de entrada ou com base em coordenadas X, Y e em colunas e linhas para definir a resolução da camada de saída. Se a camada de entrada tem uma resolução diferente, os valores serão redefinidos com o algoritmo vizinho mais próximo.

The Operators section contains all usable operators. To add an operator to the raster calculator expression box, click the appropriate button. Mathematical calculations (+, -, *, ... ) and trigonometric functions (sin, cos, tan, ... ) are available. Stay tuned for more operators to come!

With the checkbox Add result to project checkbox the result layer will automatically added to the legend area and can be visualized.

Examples

Convert elevation values from meter to feet

Creating an elevation raster feet from a raster in meter, you need to use the conversion factor for meters to feet: 3.28. The expression is:

Using a mask

If you want to mask out parts of a raster, because you are only interested in elevations above 0 meter, you can use following expression to create a mask and apply the result to a raster in one step.

For every cell greater than or equal to 0, set its value to 1, otherwise set it to 0. This creates the mask on the fly.