4

I know this question has been asked already in this forum, but I couldn't find an easy (for me, a rookie) solution for my problem. I have an RGB 3 band file which, in some pixels, has i.e.

R no data
G 147
B 147

This creates problems in the visualization of the raster. I'd like to know how to change those values to 0, enabling the colours to be correctly displayed again. I tried to use an algorithm in the processing tab, but it says SAGA algorithms are not supported by multiband layers. Also I've seen many using GRASS tools, but I really have no clue on how to use GRASS, so I would need a step by step explanation. Consider I am still a newbie with this software so, if possible, I'd like use the easiest method.

4
  • Welcome to GIS:SE @RiccardoBoniardi! There's also GDAL which has the Fill nodata tool, you could access this from the Processing Toolbox. – Joseph Jan 22 '16 at 11:15
  • Some gdal approaches suggested here and GRASS/QGIS Raster plugin options here – dmci Jan 22 '16 at 11:21
  • Hello, thanks for the welcome. I looked into my processing toolbox but i have no such tool as fill no data. I guess i miss some plugin or something (my version is 2.8.4). I also read that the fill no data uses interpolation as a method to fill nodata, but i want them to be replaced with 0 exactly, so i dunno if that method would be suitable. Any ideas? Thanks again – Riccardo Boniardi Jan 22 '16 at 11:23
  • @RiccardoBoniardi - There should be a menu at the bottom of your Processing Toolbox which probably says Simplified interface. If so, change this to Advanced interface to obtain a lot more tools. But yes, you are correct in that interpolation is used for the Fill nodata tool. You should probably have listed which questions you looked at to stop others suggesting the same ones :) – Joseph Jan 22 '16 at 11:32
4

As Joseph suggested, the Fill nodata tool solves your problem. It replaces NoData values with 0's, in the band of your choice.

You can find it either in Raster > Analysis, or (with a slightly different interface) Processing > Toolbox > GDAL/OGR > [GDAL] Analysis (in QGIS 2.8).

Edit: of course, this assumes that GDAL is correctly installed and can be "seen" by QGIS.

Edit 2: as mentionned, Fill nodata outputs only the processed band. A possible solution would be to split your bands (there's a SAGA tool called Split RGB bands in the processing toolbox), then apply the Fill nodata tool, then merge your bands back (Raster > Miscellaneous > Merge).

10
  • Hello, thanks for the help. I tried the "raster analysis" tool, but the output file i got was single band, so its still not displayed correctly. As i said, the original TIF file is a 3 band file, and i'd need to change all nodata values to 0 for each of the 3 bands. Maybe i did something wrong, but there wasnt much to click =) – Riccardo Boniardi Jan 22 '16 at 11:38
  • You're right, this is a bit more complicated than expected. I updated my answer, hope this will work for you. – ArMoraer Jan 22 '16 at 11:47
  • I will try this method, but i also might have found a workaround. I converted the TIF to a PNG and this fixed the colour visualization problem ofc. Now, i dont really need the 3 bands, i just need a correctly visualized image, probel is, the PNG is not georeferenced. Now, i know there is the geo referencing tool, but i'd like to keep the exact referencing the TIF has, which i can see in the metadata. Is there a way to define image corners coordinates and not arbitrary points for a raster layer? – Riccardo Boniardi Jan 22 '16 at 12:43
  • @RiccardoBoniardi: there is a plugin called GeorefExport that should generate a georeferenced PNG. – ArMoraer Jan 22 '16 at 12:56
  • thanks for the tip, i couldn't find the plugin in the "manage and install plugin" tab, so i downloaded from the developer page, but i don't know how to install it (its not a .dll file as the plugins inside qgis folder). If you could suggest me how to install it, i'd give it a try. Thanks again – Riccardo Boniardi Jan 22 '16 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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