I have one raster layer containing a band that indicates the land type of a random sample of pixels and another raster containing NDVI, VV, and VH values. The first raster has fewer pixels than the second, hence there are areas where the single bands of this layer would show "no data".

How would I go about transferring band values from pixels from the second raster to the first where there are actually pixels in the first raster (the single band has a value)?

A similar question to mine, Extracting value from one raster to another raster using QGIS, suggested using the raster calculator with the expression "layer1"*"layer2", but this only returns one band that seems to have just multiplied the two bands from the input rasters. I am a beginner when it comes to using QGIS, and especially to using the raster calculator, hence I am having trouble finding a solution to this.


1 Answer 1


To use the first raster (let me call it Raster1) as the base layer to accommodate the values from the second one (Raster2), you can use Create Constant Raster Layer tool in the QGIS Processing Toolbox > Raster Creation.

enter image description here

(1) Click on the small ellipsis ... button and set the Raster1 as the basis for the extent calculation.

(2) Pixel size should be the cell size of the Raster1 layer. Leave the Constant value at the default 1.0 which initializes the cell value.

(3) Click on Run and you will get a new layer ('Constant').

(4) Start Raster Calculator

enter image description here

(5) Click and highlight the Constant@1 (1) then click on Selected Layer Extent button (2).

(6) Name the output file path and file name (3).

(7) Input the equation "Constant@1" * "Raster2@1" (4) and click on OK to run.

enter image description here

Then the values from the Raster2 (lower left) will be copied across to the Raster1 (upper right) grid system. (see the Output layer which is shown in grey scale).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.