in QGIS 2 windows
I have some index layers I use for loading raster and vector tiles through an Python action. Currently I am using absolute paths which works fine but I would like to set it up so other teams can use the tiles. I have been trying to get the path of the active layer (the index layer) and use that but had no luck.
I would also like to be able to load the new layers in a specific group to keep projects tidy – can this be done?
Best Answer
If you want path to the current project you can do:
and the layer path using:
Getting the last folder:
Then you should use
os.path.join
to join on your new paths:To load a layer with the new path you would do something like this:
Just copy and paste this into a layer action and change the type to Python and it should work.