I have created a hotlink in QGIS 3.0, whereby the hotlink is designed to open another piece of GIS information. The link works as I want, expect it opens a new instance of QGIS. How do i get the hotlink item to load into the existing instance of QGIS that is already running?

I have used the following options Type = Open url Action [% "path"%]


You can use actiontype Python and use a script to perfom something like loading a new layer. The script for loading a new layer based on a field "path"- which contains for example the path and file name of a shapefile (c:/pathtoshapefile/myshapefile.shp) - would be something like this:

from qgis.utils import iface
layer = iface.addVectorLayer(r'[% "path" %]', 'new theme name', 'ogr')

see https://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/loadlayer.html for more information

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.