I am new to the QGIS python console. I am trying to load a raster layer from the console, set the crs and a specific style from a qml file.
layerPath = os.path.join(raster_dir,raster_name)
fileInfo = QtCore.QFileInfo(layerPath)
baseName = fileInfo.baseName()
layer = QgsRasterLayer(layerPath, baseName)
I would like to set up the projection info and then load it to QGIS
QgsMapLayerRegistry.instance().addMapLayer(layer)
I do have a grey raster on the windows. How can I set up the qml file to load ?
Thanks for your help
uri = "file:///home/renaud/palette.qml";layer.loadNamedStyle(uri)I get the error message : Style not found in databased. Thank for your help ? How do I jump line in this post ? – Renaud Jun 06 '12 at 09:37theUriis a bit misleading - using the plain filename should work (ie./home/renaud/palette.qml) – jef Jun 06 '12 at 13:25