[Qgis-user] click on raster outline to make it visible
Michel Stuyts
michel.stuyts at edegem.be
Fri May 25 01:16:55 PDT 2018
It looks like the \r in the path is interpreted as a carriage return and the \t as a tab and so a part of the path is missing for GDAL. Maybe you can try to replace the \ by \\.
Info on Escape Sequences:
- http://python-reference.readthedocs.io/en/latest/docs/str/escapes.html
- http://en.cppreference.com/w/cpp/language/escape
I also notice a mix of \ and / in the paths. I don't know if that can cause problems.
Michel
-----Oorspronkelijk bericht-----
Van: Qgis-user [mailto:qgis-user-bounces at lists.osgeo.org] Namens Reginald
Verzonden: vrijdag 25 mei 2018 10:02
Aan: qgis-user at lists.osgeo.org
Onderwerp: Re: [Qgis-user] click on raster outline to make it visible
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
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
More information about the Qgis-user
mailing list