TransWikia.com

Falsecolor raster from multiple rasters in QGIS

Geographic Information Systems Asked on November 26, 2021

How can I combine multiple single band rasters into a falsecolor RGB background in QGIS?

I can, of course, use the multiband color renderer to select specific bands, call them A1,A2,A3 from a single raster file source A to R,G,B channels. But I have the desired bands in different files, so it’s R=A1, G=B2, B=C1 that I need.

Desired combination

For the moment, I am creating and maintaining a monster .vrt with A1…An,B1…Bn,C1…Cn munged into one, and then using the multiband color renderer. This requires annoying editing of an XML file to add <Description> tags and to overcome to inability to add different -b switches with -separate in the gdalbuiltvrt call the QGIS Build virtual raster... algorithm uses. I’m hoping for a way where I could assign the right rendering settings to each layer in the QGIS layer tree so that they would individually render as in the 3 rightmost images above, and when all 3 are checkmarked in the layer tree they would add as at left.

I’ve tried using the Singleband grey renderer for each input layer and colorizing it in Layer rendering settings. But that keeps whites white and only shifts the midgreys. So I created my own color maps from #00000 to #ff0000 (etc.). But now the topmost layer wins, unless I adjust transparency in which case the color gets washed out. So I’ve been playing with the blending mode (e.g. Darken and Screen as opposed to Normal) but can’t seem to get the logic right.

This ought to be simple, so I’m probably barking up the wrong tree!

BTW, the reason for this is exploration of different spectral bands and ratios across a time sequence of Sentinel 2 images to discover what combination of data will best pinpoint forest insect damage.

One Answer

I'm not sure if this will work with your layers but I got it to work with Simple vector layers. So following vague color theory. Wikipedia RGB color theory I created a layer where each was a pure Red Green or Blue and had a subtract blend mode applied. First I tried the addition blend mode but this didn't work. However I found that if you create a black under layer and use the subtract blend mode they combine correctly. Without the black under layer QGIS used the map canvas color and everything is just white. QGIS RGB Subtract blend mode

I also tried Cyan, Magentna, Yellow on a white background but that didn't give me the results I expected but might work for your files.
QGIS CMY colors suntract blend mode

Answered by Baswein on November 26, 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