Hi Grant,
My advice would be to have a shared drive, or network drive, which both
machines access with the same path.
But...in the absence of that, you could also modify your path if you prefer...
The Filepath attribute could be shortened/modified, and you can manually set
the start of the path. So for example..
You can set your "filepath" attribute to something like..
someRootfolder/somesubfolders/ and your action text would be
1. MACHINE1
qgis.utils.iface.addRasterLayer('C:/somefilepath/[%filepath%][%filename%]','[%filename%]')
2. MACHINE2
qgis.utils.iface.addRasterLayer('E:/someOTHERfilepath/[%filepath%][%filename%]','[%filename%]')
As long as the attributes stay the same, as in the same Root and Subfolders,
then the first path can be anything...
So for arguments sake...
1. MACHINE1
qgis.utils.iface.addRasterLayer('D:/00_DATA_VALIDATION/[%filepath%][%filename%]','[%filename%]')
2. MACHINE2
qgis.utils.iface.addRasterLayer('//some_network_host/localdrive/00_DATA_VALIDATION/[%filepath%][%filename%]','[%filename%]')
I hope that's helps.
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/[email protected]
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: [email protected] <[email protected]>
Sent: 20 May 2023 00:29
To: Richard McDonnell <[email protected]>
Subject: RE: [Qgis-user] Click to open layer
Hi Richard,
Thanks for that. Can I use a project path that points to the project folder,
something like '.\' ? I use two different machines and so it would be good to
be able to use the local address.
Cheers Grant
From: Richard McDonnell
<[email protected]<mailto:[email protected]>>
Sent: Friday, May 19, 2023 11:42 PM
To: [email protected]<mailto:[email protected]>
Cc: [email protected]<mailto:[email protected]>
Subject: RE: [Qgis-user] Click to open layer
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:[email protected]]
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/[email protected]
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
<[email protected]<mailto:[email protected]>>
On Behalf Of Grant Boxer via QGIS-User
Sent: 19 May 2023 09:47
To: [email protected]<mailto:[email protected]>
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
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user