lizmap-web-client
lizmap-web-client copied to clipboard
Map composer layout themes are no longer being respected when printing
What is the bug?
When using lizmap with commit a38983a3137ccf387156f9ad23026f48dbff8208 I can generate print layouts that preserve the map themes setup
While running the latest version the following is depicted
It seems the plugin is respecting visible layers over generic map layouts
Steps to reproduce the issue
Scenario A - Running latest
- Clone the repository https://github.com/3liz/lizmap-docker-compose
- Spin up lizmap
- Modify the project
france_parts.qgs
to add a layout associated with a theme - Activate print in the config
- Print the map in the browser
Scenario B
- Clone the repo https://github.com/3liz/lizmap-docker-compose
- git checkout commit a38983a3137ccf387156f9ad23026f48dbff8208
- follow the instructions in scenario A
Versions
Running the latest docker compose from https://github.com/3liz/lizmap-docker-compose/blob/master/docker-compose.yml vs https://github.com/3liz/lizmap-docker-compose/blob/a38983a3137ccf387156f9ad23026f48dbff8208/docker-compose.yml
QGIS server version, only if the section above doesn't mention the QGIS Server version
3.16 and 3.22
Operating system
Ubuntu 20.04
Browsers
Firefox, Chrome
Browsers version
Firefox
Relevant log output
No response
I have the same problem since i use the 3.5.5 LWC version. Have you found a solution ?
Maybe I misunderstand how it was managed before if it was working. But without a new settings or an option, it would be confusing if the end user (the one who doesn't know what is a qgis print layout with a theme setup) if the map doesn't show layers visible when he clicks the print button. It looks normal that the print is following what is displayed on the main map. (as he can choose the extent, the format etc, the user decides everything in this kind of print).
The use-case is very different for an layout with an atlas, because the layout is linked to the feature.
OK, it's your opinion...
When you want that users have always the same list of layers, it is very kind to define a theme setup. That's why, i have define 7 or 8 different themes and the associated layout and another one to print exactly what they see on the main map.
When they clicked on the print button, they could choose anyone of theme map even if they haven't change the displayed layers on the main map.
I think it's a regression and this software reaction is not conformed with the layout having a theme setup...
I will adapt to ask end users to activate the theme before print... Do you know how to print the theme name in the layout ?
I am not sure there were release notes indicating that this would be the change going forward. My guess is that this stopped working between versions 3.3 to 3.4.
If the correct behaviour is to print visible layers this should be updated in the documentation to indicate that layout themes are not supported.
Currently, the only solution that I have done is to have a QGIS Server plugin that modifies the getprint request injecting layers you need for printing corresponding to a theme.
@Alain-LG Supporting theme is definitely a good idea for Lizmap ! I was just talking about the current state of the print window for the UX (User eXperience). Using this print window, the user is used to have a WYSIWYG experience, (What You See Is What You Get), the user can choose is own extent, own visible layers, background etc beforehand. IMHO, from an end user, if a template has a fixed theme (so layers visible, not visible), I would like to be informed before clicking on the "print" button and Lizmap to change to the theme so I would be aware that my layers that I made visible or not won't be respected. This is just indeed my opinion.
I think it's a regression and this software reaction is not conformed with the layout having a theme setup...
I totally understand your point and it's also valid ;-) ! To make a user-friendly web interface like Lizmap based on a GIS advanced software such as QGIS, there are a lot of caveats to manage. The usage between web and desktop is very different.
We would be happy at 3Liz to have a combobox showing different theme in this print dialog or to find a solution.
Do you know how to print the theme name in the layout ?
I don't know if it's available. I had a quick look the expression output from item_variables('Map 1')
, I didn't see it. It would be a nice addition in QGIS core (which would work in both desktop and server).
this is definitely a regression @Gustry. Please re-introduce the old behaviour and make the new behaviou a configurable (even default) option.
Our very popular SAGTA Map Downloader has depended on the old behaviour for three years now and this really breaks it and results in lots of user complaints and queries.
For us, the web interface is a place to choose a location and size for the layout. We don't want all the layers in the web interface as it makes it slower and more complex than necessary.
We want the layouts to be generated based on our QGIS project layers, themes and settings and not by the web UI.
Just some side notes from a discussion about QGIS server behavior :
QGIS server, during a GetPrint
request, disables "Follow map theme" or "Lock layers" checkbox.
I have tested with QGIS Server 3.22 and Lizmap master:
- "Follow map theme". It does NOT work as we would expect. But it works if I remove the
LAYERS
parameter in URL. It seems expected regarding this comment https://github.com/qgis/QGIS/issues/42036#issuecomment-794164884 . A solution would be to detect this configuration and not useLAYERS
in this case or let the user decide. - "Lock layers". It works as expected. In this case the
LAYERS
parameter does not override the option. It is not consistent with "Follow map theme".
In every case, the Lizmap print interface would have to be changed to inform the user of those special parameters.