Hi Grant,
Do you mean insert a GeoTIFF in?
If that's the case, then you want the following Action..

Type: Python
Description: Add Raster to Canvas or whatever you want
Action Text: 
qgis.utils.iface.addRasterLayer('[%filepath%][%filename%]','[%filename%]')

For the above to work, you will need two attributes in your Polygon, a 
"filepath" and a "filename" attribute. In the fileparh is the Path to the 
folder containing the GeoTiff and the filename is the name of the file you are 
looking to load... so something like this...

[cid:image001.png@01D98A70.D05A4F50]

This should then load any GeoTIFF into your Canvas.
Kind Regards,

Richard


--
Richard McDonnell MSc GIS, FME Certified Professional
FRM Data Management

--
Oifig na nOibreacha Poibl?
Office of Public Works

Sr?id Jonathan Swift, Baile ?tha Troim, Co na M?, C15 NX36
Jonathan Swift Street, Trim, Co Meath, C15 NX36
--
M +353 87 688 5964 T +353 46 942 2409
https://gov.ie/opw

--
To send me files larger than 30MB, please use the link below 
https://filetransfer.opw.ie/filedrop/richard.mcdonn...@opw.ie

Email Disclaimer: 
https://www.gov.ie/en/organisation-information/439daf-email-disclaimer/

--
MSc GIS, FME Certified Professional

--
Oifig na nOibreacha Poibl?
Office of Public Works

Sr?id Jonathan Swift, Baile ?tha Troim, Co na M?, C15 NX36
Jonathan Swift Street, Trim, Co Meath, C15 NX36
--
M +353 87 688 5964 T +353 46 942 2409
https://https://gov.ie/opw<https://www.opw.ie>

--
Email Disclaimer: 
https://www.gov.ie/en/organisation-information/439daf-email-disclaimer/<https://www.opw.ie/en/disclaimer/>
From: QGIS-User <qgis-user-boun...@lists.osgeo.org> On Behalf Of Grant Boxer 
via QGIS-User
Sent: 19 May 2023 09:47
To: qgis-user@lists.osgeo.org
Subject: [Qgis-user] Click to open layer

I am sure there is a simple way to do this but I would like to click on a 
polygon and get it to open a tiff file into my map canvas. Do I use an Action 
and an "open" command?
Regards Grant Boxer

_______________________________________________
QGIS-User mailing list
QGIS-User@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to