Outdated version of the documentation. Find the latest one here.

Raster Calculator

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:


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.

In the Result layer section you have to define an output layer. You can then define the extent of the calculation area based on an input raster layer or based on X,Y coordinates and on Columns and Rows to set the resolution of the output layer. If the input layer has a different resolution, the values will be resampled with nearest neighbor algorithm.

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.


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.