Legend graphics¶
By default, QWC2 will obtain the legend graphics of a layer from QGIS Server.
Customizing the GetLegendGraphics request¶
You can customize the GetLegendGraphics request by specifying additional query parameters in via extraLegendParameters in the theme configuration block. The list of supported query parameters is documented in the QGIS Server documentation.
Providing custom legend images¶
You can provide custom legend images by enabling the qwc-legend-service.
Configure legend_images_path in the legend service configuration in tenantConfig.json:
{
"name": "legend",
"config": {
"default_qgis_server_url": "http://qwc-qgis-server/ows/",
"legend_images_path": "/legends/"
}
}
Note: The legend folder needs to be mounted into the qwc-legend-service container, i.e.:
qwc-legend-service:
image: sourcepole/qwc-feature-info-service:vYYYY.MM.DD
volumes:
...
- ./volumes/legends:/legends
Then, legend images will be searched for in this order (the first one found is used):
- A
<legend_images_path>/<service_name>/<layername><suffix>.pngfile, where service_nameis the name of the WMS servicelayernameis the WMS layer namesuffix: empty, or one of_thumbnail,_tooltip. The suffix is passed by QWC2 to the legend service depending on the requested image type.- A
<legend_images_path>/default<suffix>.pngfile for a default legend image. - A
<legend_images_path>/<legend_image>file withlegend_imageas specified for the desired layer in thelegendservice configuration, for example:
{
"name": "legend",
"config": ...,
"resources": {
"wms_services": [
{
"name": "<service name>",
"root_layer": {
"name": "<root_layer_name>",
"layers": [
{
"name": "<layer_name>",
"legend_image": "edit_points.png"
}
]
}
}
]
}
}