[GIS] Multi-Band (RGBA) into single band raster

bandcolortablemulti-bandqgisrgb

I have the raster which contains 4 bands (RGBA), which ilustrates the pupulation (traffic) density. I want to convert it to the simple gridded ascii, however I'm getting in the trouble when I try the export it to the different formats. I suppose it comes from multi-band property of this map, therefore:

Is there any way I can convert from RGBA to single value representing the data I need ?

E.g. when I want to convert using RGB2PCT:

ERROR 1: TIFFOpen:traffic_przyciety2: Permission denied Traceback
(most recent call last): File "C:\PROGRA~2\Quantum GIS
Lisboa\bin\rgb2pct.py", line 136, in
tif_ds.GetRasterBand(1).SetRasterColorTable( ct ) AttributeError:
'NoneType' object has no attribute 'GetRasterBand'

BTW: AttributeError: 'NoneType' error is dropped in other functions as well when I want to do something on this map

Info about the map:

Band 1 Block=903×1 Type=Byte, ColorInterp=Undefined Min=0.000
Max=255.000 Minimum=0.000, Maximum=255.000, Mean=254.667,
StdDev=9.206 Band 2 Block=903×1 Type=Byte, ColorInterp=Undefined
Min=0.000 Max=124.000 Minimum=0.000, Maximum=124.000, Mean=119.886,
StdDev=7.547 Band 3 Block=903×1 Type=Byte, ColorInterp=Undefined
Min=0.000 Max=0.000 Minimum=0.000, Maximum=0.000, Mean=0.000,
StdDev=0.000 Band 4 Block=903×1 Type=Byte, ColorInterp=Undefined
Min=0.000 Max=255.000 Minimum=0.000, Maximum=255.000, Mean=217.937,
StdDev=67.026'

Alternatively, do you know if there's any standard interpretation of the geodata maps ?
E.g. if the resulting pixel value may be obtained by specific operation on the bands ?

Thanks for the answers

BR
Krzysztof

Best Answer

It depends what do you want to do with your outout data. Is your data on 1 of the layers of the raster or you have to convert 3 or 4 bands into 1? Either way you can make use of raster calculator. If you want mean of 3 or 4 bands in your output raster just add them up and divide by number of lyers: (r@1 + r@2 + r@3)/3, else you just select band of interest and export it to new file. Thats in theory, as I did not test it on QGIS.