TransWikia.com

Problem with photo displaying in QGIS 3.10

Geographic Information Systems Asked by A.Badouk on November 1, 2021

I would like to know how to display a photo in a image viewer with a featured action.
I create a layer with 3 fields: id, leyenda and filepath. Filepath is the field where I put my photo..

example1
Then I created an action to open the picture who will be attached
example2
But when I use the action (the cursor change) nothing happened.

Do you know why and how to solve the problem ?
example3

One Answer

After some playing around, here are 2 issues that might be getting in the way.

  1. While display of an image inside QGIS using the form File widget respects relative paths (if Relative Paths is checked), I don't think an Open action does. So there instead of [%filepath%] try [%concat(@project_home || '\', "filepath" )%]. This will prepend the project home path to the filename to make it fully qualified. (The '\' becomes the single backslash used in Windows, of course.)

  2. Shouldn't be the case for .jpg, but you need to have a file association in place in the operating system to be able to automatically open the filenames passed to it. It's possible this is somehow broken on your system.

What's unfortunate is that if the OS doesn't know what to do with the (incomplete or unassociated) filename in the action, no error message is generated, just nothing happens. So to debug such problems, I suggest the following.

A. Copy the contents of "filepath" (or whatever) for one feature.

B. Open a terminal window (via the Browser or otherwise) in a random directory.

C. Try to execute as a command that one filename, by typing " then Ctrl-V to paste what you just copied then another ".

If it's all good, it should open the file, both this way as well as in your desired QGIS action. If it's not working, you'll hopefully get a meaningful error message this way why it's failing.

Answered by Houska on November 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP