[Qgis-developer] color ramp shader in python

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Tue Jan 20 07:58:22 EST 2009


Hi all,

 I want to setup a custom colormap shading of a raster in Python.
Previously I did:

        self.setValueClassification(schemeVCL)
        self.setCustomClassificationEnabled(True)
        self.setDrawingStyle(self.SINGLE_BAND_PSEUDO_COLOR)

Where schemeVCL was a list of QgsRasterLayer.ValueClassificationItem objects.

Now it's all changed, but I can't see how to set the color map of a
shader in Python. QgsColorRampShader doesn't seem to be wrapped, and
there's no colorTable() method on raster layers either.

 The only way I can see to do it is to write a QgsRasterShader in
python, but that would be duplicating what a QgsColorRampShader does
anyway, and it would probably be much slower because it'll be calling
back to python for every colour look-up.

 Or am I doing it wrong?

Barry


More information about the Qgis-developer mailing list