[Qgis-developer] color ramp shader in python
vkepoglu at gmail.com
Thu Jan 22 07:48:49 EST 2009
i do not get what you mean, but you maybe try what i am using below
python sample code in qgis 1.0 preview 2 for win.
fileInfo = QtCore.QFileInfo("c:/temp/r_b.tif")
# add a (hardcoded) layer and zoom to its extent
rstlayer = QgsRasterLayer(fileInfo.filePath(), fileInfo.completeBaseName())
if not rstlayer.isValid():
raise NoValidRaster, "raster layer is not valid."
# add layer to the registry
# set extent to the extent of our layer
On 1/20/09, Barry Rowlingson <b.rowlingson at lancaster.ac.uk> wrote:
> Hi all,
> I want to setup a custom colormap shading of a raster in Python.
> Previously I did:
> Where schemeVCL was a list of QgsRasterLayer.ValueClassificationItem
> 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?
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
More information about the Qgis-developer