[Qgis-user] click on raster outline to make it visible

Reginald Reginald.Carlier at ingelmunster.be
Fri May 25 01:01:50 PDT 2018


Hello,

I have defined an action with the following python code:

from PyQt4.QtCore import QFileInfo
fileName ="[%"Locatie"%]";
fileInfo = QFileInfo(fileName);
baseName = fileInfo.baseName();
qgis.utils.iface.addRasterLayer(fileName, baseName);

The problem that I’m having is that the string stored in the Locatie field
gets interpreted.
In a path name like
F:\Ingelmunster\riolering\infraxscans\tif2/331-Meulebekestraat_Leon_Bekaertstraat_Mandesweg_GP_deel2.tif 
\t creates a tab spacing and \r removes a character.

Ongeldige Laag: GDAL provider Cannot open GDAL dataset F:\Ingelmunster
iolering\infraxscans
if2/335-Meulebekestraat_Lammekensknokstraat_Bollewerpstraat_Bekaertstraat_Ringlaan_GP_deel3.tif:
`F:\Ingelmunster iolering\infraxscans
if2/335-Meulebekestraat_Lammekensknokstraat_Bollewerpstraat_Bekaertstraat_Ringlaan_GP_deel3.tif'
does not exist in the file system, and is not recognized as a supported
dataset name.

How can I load the rasterfile with the filename that is stored in the
Locatie field into qgis?
Is there any comprehensive tutorial on actions?

Regards,




--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-User-f4125267.html



More information about the Qgis-user mailing list