I am using QGIS 3.6.

By clicking on a polygon I want that an image associated to this polygon appears (as a pop-up window e.g.). The path for the pics are stored in the attribute table (string field).

Creating a generic action: action window

with the following action text:

open [%image%] or open [%"image"%]

doesn´t function showing the error:

error message

With these instructions the action still doesn´t function.

What I´m doing wrong?

UPDATE: the appropriate images are store locally (no websites, no URL links). The images should appear locally and not as a website pop up in QGIS.


This method works for websites or images (will show in a QGIS 3 Window/Browser)

You will need to point your field url in this case with some Python.

In this case, using the url field (and linking an action)


Then using the Python code

from PyQt5 import QtCore
from PyQt5.QtCore import *
from PyQt5.QtWebKit import *
from PyQt5.QtWebKitWidgets import *
web = QWebView()


then click on the action "open web"

creates a new window QGIS 3 to the web URL (or image)


this can be your localhost (depending on if using mac/windows/unix)

  • Thx for the detailed answer. I just updated my question. The action should be able to display locally stored images and not websites (relative paths in the appropriate attribute table field and not url links). – Mapos Sep 24 '19 at 20:37
  • QGIS can pull up the images from your local pc and display them. – Mapperz Sep 25 '19 at 2:34
  • Yeah, without doubt :) I suggest a python code similar to the url links is necessary. Do you have any idea how the python code should look like? Unfortunately I´m not a python expert so I don´t know the exact variables and parameters. Txh in advance. – Mapos Sep 25 '19 at 8:28

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.