3liz / lizmap-web-client

Transfer a QGIS project on a server, Lizmap is providing the web interface to browse it
https://www.lizmap.com
Mozilla Public License 2.0
255 stars 143 forks source link

Map composer layout themes are no longer being respected when printing #2999

Open NyakudyaA opened 2 years ago

NyakudyaA commented 2 years ago

What is the bug?

When using lizmap with commit a38983a3137ccf387156f9ad23026f48dbff8208 I can generate print layouts that preserve the map themes setup

Peek 2022-05-17 10-42-3 3

While running the latest version the following is depicted Peek 2022-05-17 10-48-latest

It seems the plugin is respecting visible layers over generic map layouts

Steps to reproduce the issue

Scenario A - Running latest

Scenario B

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

Alain-LG commented 2 years ago

I have the same problem since i use the 3.5.5 LWC version. Have you found a solution ?

Gustry commented 2 years ago

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.

Alain-LG commented 2 years ago

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 ?

NyakudyaA commented 2 years ago

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.

Gustry commented 2 years ago

@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).

gubuntu commented 1 year ago

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.

Gustry commented 1 year ago

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.

nboisteault commented 1 year ago

I have tested with QGIS Server 3.22 and Lizmap master:

In every case, the Lizmap print interface would have to be changed to inform the user of those special parameters.