Bug report #6291

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

Added by Marco Lechner over 7 years ago. Updated over 4 years ago.

Status:Closed
Priority:Normal
Assignee:-
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

Description

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 *
QgsApplication.setPrefixPath("/usr",True)
QgsApplication.initQgis()
QgsApplication.registerOgrDrivers()
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

History

#1 Updated by Jürgen Fischer almost 6 years ago

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

#2 Updated by Médéric RIBREUX over 4 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