Bug report #16899

Updated by Giovanni Manghi over 6 years ago

It was ok until at least 2.14.16

This has direct effect on how map legends can be printed using QGIS Server and a GetPrint request.

The problem is:
how do I get a printed map via GetPrint where the legend is *fixed* regardless the layers listed in the request (that are the layers that are then visible within the map object)?

Well the solution was this "none" value for the "map" option for any legend object. In this way the legend was "unlinked" from any map object and as a result it was always printed as defined in the print composer options (of course with the "auto update" and the "filter" not enabled).

So with a request like

http://localhost/cgi-bin/qgis_mapserv.fcgi?map=/path/to/my/project.qgs&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetPrint&FORMAT=pdf&TRANSPARENT=true&SRS=EPSG:3857&DPI=100&TEMPLATE=Landscape%20A4&map0:extent=420232.0463583274,5395327.438198717,443932.6162906727,5414427.897511283&map0:scale=100000&map0:LAYERS=points%20of%20interest&LAYERS=points%20of%20interest

where just 1 layer is requested to be visible in the map, we could get the legend also for all the other layers (defined in the layout composer in QGIS):

https://www.dropbox.com/s/f1jtr2i8qfbm5sw/qgis_server_with_none_option.pdf?dl=0

When instead of "none" the legend is associated to a map object like "map0" then the result is different, only the symbology synbols/classes for requested layers are added to the legend:

https://www.dropbox.com/s/svgbmx8sor7jjuz/qgis_server_without_none_option.pdf?dl=0

In QGIS 2.18.10 the value "none" is no more available, not allowing to get anymore the first result presented above (again, this affect only the maps printed via QGIS Server with GetPrint)

Both the above examples are obtained using QGIS Server 2.18.10 on a project saved in 2.14.16, this shows the issue in QGIS Desktop print composer rather then the Server.

Moreover if instead the project is saved with QGIS Desktop 2.18.10, the result of the above request is different and looks wrong, with "?" shown instead of (at least) the layer names, as in the second case above linked:

https://www.dropbox.com/s/hfsvul4uy3h5uqa/qgis_server_without_none_option_2_18.pdf?dl=0

Back