HTML map tips in QGIS

New fresh QGIS feature! So fresh in fact you can still smell the wet paint :)

QGIS (development build) can now display map tips using HTML (a subset anyway).

To enable the new map tips: Open the Layer Properties dialog for a layer and select the Display tab

Display tab to set HTML map tips

In action

Layer properties for HTML map tip

Notice how we can also use a QGIS expression. Anything inside [% %] will be evaluated and replaced with the value in real-time. We can even use a CASE statement. Pretty cool!

And the result when hovering over a feature

HTML in QGIS map tip? Yes! WOOT!

Hold on. Pause the track! We can even use some CSS to make it more fancy.

h1 {color:red;}
p.question {color:blue;}
<h1> [% "NAME" %] </h1>
<img src="[% "image" %]" />
<p class="question">Is this place a country?</p>
[% CASE WHEN "TYPE" = 'Country' THEN 'Yes' ELSE 'No. It is a ' || "TYPE" END %]
CSS in a html map tip

Happy Mapping :)

7 thoughts on “HTML map tips in QGIS

  1. That’s awesome. Has there ever been any discussion on having an option to format the identify results with HTML/Javascript?

    1. Not really. The support for HTML in map tips is quite limited (it’s more just fancy rich text then true HTML). I am however working on HTML annotations which use QtWebKit which is true html support including the ability to run javascript. Once that is done you can use the values from the feature in some javascript to generate a graph in a annotation.

  2. […] commando and the other will show images when you just hover the mouse over one feature using the Map Tips tool in QGIS: Berlin is the city for the geo-industry…‎ var disqus_url = […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s