TransWikia.com

Transferring raster band features to another raster in QGIS

Geographic Information Systems Asked on December 21, 2021

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.

One Answer

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).

Answered by Kazuhito on December 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP