Legend

The legend object shows a legend of the layers that are displayed in the map. Not every layer provides a legend. In addition to the legend image you can display the service title, layer name and group name (if a group exists).

../../../_images/legend1.png

Configuration

../../../_images/legend_configuration1.png
  • Open automatically: If activated, the legend opens when the application is started (default: active).

  • Title: Title of the element. The title will be listed under Layouts. Is also shown next to the button, if “Show layer title” is activated.

  • Show source title: shows WMS/source title (default: true)

  • Show layer title: shows layer title (default: true)

  • Show grouped layer title: shows group title for grouped layers (default: true)

The Legend element is integrated via a Button or in the sidepane.

Configuration Examples

Legend in the Sidepane

If you want to integrate a legend in the sidepane, click on mapbender-button-add in the Layouts-tab (section “Sidepane”).

../../../_images/add_sidepane2.png

Then, choose the element “Legend” in the appearing window. The configurational dialog “Add element – Legend” will open.

../../../_images/legend_example_sidepane_dialog1.png

Our configured element has the title “Legend”. The legend opens automatically (set checkbox Open automatically). Moreover, the layer title and the title of all grouped layers will appear if the checkboxes Show layer title and Show grouped layer title are set.

Given this configuration, the result looks like this:

../../../_images/legend_example_sidepane1.png

In the example the legend was added to the sidepane.

Legend in the toolbar

The legend element can be integrated with a button in the toolbar. First step: Open the application Backend and add the legend element into the map area section of the Layouts tab.

../../../_images/add_map_area1.png

In this example, the following settings are chosen:

../../../_images/legend_example_sidepane_dialog1.png

As soon as this element has been implemented into the map area, a Button has to be implemented into the toolbar section. Following these instructions, the result in the application looks like this:

../../../_images/legend1.png

The toolbar shows the button for the legend element. If the button is clicked, the dialog with the generated legend opens. With the “Open automatically” setting, the dialog is displayed directly when the application is started.

The activation and deactivation of checkboxes in the configurational settings leads to:

../../../_images/legend_example_toolbar_checkboxes1.png

YAML-Definition

This template can be used to insert the element into a YAML application.

tooltip: 'Legend'                    # text to use as tooltip
elementType: dialog                  # dialog/blockelement (default: dialog)
autoOpen: true                       # true/false open when application is started (default: true)
displayType: list                    # accordion/list type of display (default: list)
target: ~                            # Id of Map element to query
hideEmptyLayer: true                 # true/false hide when no legend is available (default: true)
showWmsTitle: true                   # true/false show WMS title (default: true)
showLayerTitle: true                 # true/false show layer title (default: true)
showGroupedLayerTitle: true          # true/false show group title for grouped layers (default: true)

You can optionally use a button to show this element. See Button for inherited configuration options.