New features in RasterCalc

04.08.2011 08:47 ·  GIS  ·  qgis, plugins, rastercalc

I can’t stop being pleased with the popularity of RasterCalc. It is a very useful and, above all, functional tool. Today, the calculator has two new functions (the initial patch was provided by Ludovic Mercier): composeRgb and extract.

The composeRgb function creates a 3-band raster from individual channels. Example of use:

composeRgb([clearcuts]@1, [clearcuts]@4, ([clearcuts]@5 + [clearcuts]@6) / 2)

The output will be a 3-band raster: band 1 of the clearcuts raster will be used as the first output band, band 5 of the clearcuts raster will be used as the second output band, and the third output band will be the average of bands 5 and 6 of the clearcuts raster.

The extract function extracts a subset of bands from a multiband raster and saves it as another raster. Example of use (assuming the Clearcuts raster has 10 bands):

extract([clearcuts]@1, 3, [5,7], 10)

The output will be a multi-band raster consisting of channels 3, 10 and all channels from the interval [5, 7]. I.e. the output image will have 5 bands (bands 3, 5, 6, 7 and 10 of the input raster).

The implementation (even with my changes) is far from optimal, but I don’t have time for proper refactoring and optimisation. Maybe I will rewrite it completely later.

RasterCalc is still going strong.

⮜ Prev
Next ⮞