2

My map tips are not showing images and instead show only paths in QGIS.

HTML image

Map tip

  • Welcome to GIS SE! We're a little different from other sites. We're a Q&A site, not a discussion forum. For questions that involve code we ask that you show us where you are stuck with your own code by including a code snippet in your question. There is an edit button beneath your question which will enable you to do that and a {} button that enables you to format any highlighted code (like your HTML) nicely. Please check out our short tour for more about how the site works. Thanks. – PolyGeo Mar 31 at 8:15
1

You should check the following points :

1) The path string must be quoted in your resulting string which is not the case in the sreenshot you provided.

2) You seem to be attempting to load local file image : your images have to be on a local or remote server.

3) (in any case u forgot it) : you must activate maps tip ("Layer/Show Map Tips")

4) Here is a working example :

[% concat('<img src=\'http://localhost/images/text-letter-',right("city_name",1),'.svg\'>') %]

to have quote in the final string you must 'escape' special characters using the "\" ...

In the example i load an svg file whose name will be depending on the first letter of "city_name"

PS : a bit of formatting in the questions are always welcome ...

3

Three things needs to be addessed:

1) as @snaileater said, the path must be quoted
2) the ending </img> tag must not contain spaces, else is will be printed as text
3) a local file URL must start with file:\\

Here is a example displaying a local file:

[% concat('<img src=\'file:\\',"path", '\' width="400"></img>') %]

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.