[Qgis-developer] Images in legend

Alister Hood Alister.Hood at synergine.com
Tue Apr 23 15:48:14 PDT 2013

Hi Paulo,

> Date: Tue, 23 Apr 2013 08:34:21 +0200
> From: Paolo Cavallini <cavallini at faunalia.it>
> To: qgis-developer <qgis-developer at lists.osgeo.org>
> Subject: [Qgis-developer] Images in legend
> Message-ID: <51762B6D.3010401 at faunalia.it>
> Content-Type: text/plain; charset=UTF-8
> Hash: SHA1
> Hi all.
> I have been submitted an interesting if weird problem. Sometimes it is necessary to
> show in legend, especially for rasters but sometimes also for vectors, an image that
> shows an extract of the map for better clarity. In other software, this is done in an
> ugly fashion, by disaggregating the legend and inserting an image.
> I think we can do something better, by either defining among properties:
> * an image to use for the legend
> * a bounding box to extract the image from and put on the legend.
> The first option seems simpler, the second is probably better, as it can update the
> legend if visualization properties change.
> Thoughts?
> All the best.
> - --
> Paolo Cavallini - Faunalia

Hi Paolo, I don't see how the second option is really much better, at least for vector layers.  If you specify the bounding box manually then there is still nothing to make sure it contains an appropriate part of the map.  e.g. for a layer using the classified renderer, if someone edits the attributes of the feature in the bounding box then it might be in a different class, and your legend would be wrong.

A better solution for vector layers might be this: provide a drop-down list of all the features (listed by fid) in the layer/class/rule, so the user can either just show the symbol by itself (the way it works currently), or select a feature from the drop-down list to display the part of the map containing that feature.  

This approach would still have limitations e.g. changes to the data or project might mean that the selected feature is hidden behind something else.  But if changes to the feature mean it is in a different class, then the legend would simply revert to either displaying just the symbol by itself, or displaying the next feature which is still in the class.

Note that if you implement something for this you can probably close http://hub.qgis.org/issues/4094.


More information about the Qgis-developer mailing list