8

I've been using the great function of QGIS: "map tips". It allows to include html-formatted text (and pictures) in order to popup a window by hovering features. I use map tips for a very convenient visualization of georeferenced pictures, as I presented once on digital-geography blog

But sadly I cannot make it woking anymore since (?) few weeks, I think since I updated QGIS to 2.16.1 (and later 2.16.2)! I'm always using the same code as before:

[%CONCAT('<img src="/path/to/my/georef/pictures/',"filename",'" width="400"></img>')%]

(I know it can be written in an other way but this was working before...)

Now the frame popping up but there's just no picture enter image description here Is that a consequence of the map tips improvements of QGIS 2.16? Is there a new syntax I'm missing? Or I might have something going wrong on my comp?

Anyone sharing the issue? Any ... tip?

Note that including an Iframe link works, I tried the code proposed by mbernasocchi answering to the question "How to view a video using map-tip QGIS 2.16" and it works great.

I'm working under Kubuntu 14.04
kdelibs: 4.13.3
Qt: 4.8.6
Core: 4.2.0-42-generic
System: 32 bit

  • Did you leave a bug report? – Victor Sep 21 '16 at 15:03
  • Not yet, I wanted first to send this question and see if other people meet this issue or if it's rather a local problem on my comp. But you're right I'll do it! – Jean-François Godeau Sep 22 '16 at 8:42
  • After trying, I have the same issue (linux). Photos however still show in forms with same links. – Victor Sep 22 '16 at 8:44
  • You did not done it, I had to do (hub.qgis.org/issues/15658). And it not works great with iframe, the scollbars are still there annoyingly. – SzieberthAdam Oct 4 '16 at 8:21
  • Did you find a solution to this? I think I'm seeing the same thing, but the photo shows up if I move my cursor off the point, then back on. – Brian Fisher May 24 '17 at 14:52
1

you need to add the file:// prefix. The most portable way to use this (assuming you have the images in the same folder as the project) currently (tested on QGIS 3.2 - ubuntu) is:

<img src="file://[% @project_home %]/[% "your_relative_picture_path" %]" />

you can also add width="300" and height="300" or so if needed

please note the @project_home this is a QGIS variable that is automatically set on each project thus allowing you to maintain relative paths

  • The answer solved my question. I came to it after a looooooong time! The structure <img src="file:///any-method-to-insert-the-path" /> worked. I used src='...' instead src="..." to disambiguate use of ' and ". I also added style="width: 100%;" to force the picture fitting in the frame. Note the if you don't use the variable @project_home but, like it was in my case, a fixed path, you should start the path with file:/// – Jean-François Godeau Apr 8 at 10:30
2

This one worked for me:

<div style="width:400;height:320">
<div style="height:20; margin: 0 auto;">
[% "filename" %]
</div>
<div style="height:300; margin: 0 auto;">
<img style="max-width:400px; max-height:300px;" src="[% "filepath" %]" />
</div>
</div>
  • Thanks for reporting, I had no time yet for that. I tried your answer without success, still getting a blank frame without picture! – Jean-François Godeau Oct 6 '16 at 0:01
  • SzieberthAdam, without path QGIS won't find my pictures for sure. I don't understand your comment. BTW I'm more and more believing that the problem is on my comp, not in QGIS :-/ – Jean-François Godeau Oct 10 '16 at 9:03
  • I have explicite attributes for filepath and filename separately. The above code prints the filename only and displays the image below based on full filepath info. I was mistaken you do a string concatenation which is not necessary IMO. I meant you should replace src="[% "filepath" %]" with src="/path/to/my/georef/pictures/[% "filename" %]" in the above code. Good luck to find the root of your problem! – SzieberthAdam Oct 10 '16 at 11:19

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.