Bug report #6291

python API provides removed blueBandName() for QgsRasterLayer (returning NULL)

Added by Marco Lechner over 10 years ago. Updated about 7 years ago.

Category:Python plugins
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:15589


QgsRasterLayer('/myraster.tif',"raster") has .blueBandName() but no redBandName, greenBandName or grayBandName anymore. blueBandName should be removed, because it is not available in RasterdataProvider class (anymore?).

Try thisin python:

from qgis.core import *
layer = QgsRasterLayer('/myGeoTIFF.tif',"raster")
print dir(layer)
print layer.blueBandName()
print layer.redBandName() #crashes
for i in range(layer.bandCount()):
print layer.bandName(i)

Btw: I wonder when colorBandName() was removed from API


#1 Updated by Jürgen Fischer over 8 years ago

  • Target version changed from Version 2.0.0 to Future Release - Lower Priority

#2 Updated by Médéric RIBREUX about 7 years ago

  • Resolution set to fixed/implemented
  • % Done changed from 0 to 100
  • Status changed from Open to Closed

Hello, bug triage...

in QGIS 2.13 master (and probably in earlier versions), there is no blueBandName method for QgsRasterLayer object anymore.

I am closing this bug.

Also available in: Atom PDF