I am following an article here:Actions HowTo , specifically the piece about an action to load a raster:
Python type Add Raster Layer qgis.utils.iface.addRasterLayer('PATH_FILE','NAME_FILE_IN_QGIS')
Can anyone advise what i need to do to open a raster based on a value in the vector table (essentially I have a grid with a field containing a field of Grid_Ref for all items where a raster image exists).
I have been fiddling with the example above and got as far as an Action of Type Python, Named OpenRaster, with the following action:
qgis.utils.iface.addRasterLayer('E:\Plot Sheet Devt\1974-1984\1250k\' + "Grid_Ref" + '.TIF',"Grid_Ref")
The Python error that I am getting on running this is
File "", line 1 qgis.utils.iface.addRasterLayer('E:\Plot Sheet Devt\1974-1984\1250k\' + "Grid_Ref" + '.TIF',"Grid_Ref") ^
SyntaxError: EOL while scanning string literal
How should I go about forming the open 'PATH_FILE' and 'NAME_FILE_IN_QGIS' so that it picks the information from the Grid_Ref field in the underlying vector data?
As always, thanks for your time