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
259 stars 143 forks source link

[Bug]: Theme/VisibilityPreset error (confusion between expanded and visible) #3519

Closed TeoGoddet closed 1 year ago

TeoGoddet commented 1 year ago

What is the bug?

When selecting a theme in a project with layer groups, sometimes the visible layer are not correct.

Steps to reproduce the issue

-

Versions

3.5.8

Check Lizmap plugin

QGIS server version, only if the section above doesn't mention the QGIS Server version

3.28

Operating system

Ubuntu 20.4

Browsers

Chrome

Browsers version

Chrome 102

Relevant log output

No response

TeoGoddet commented 1 year ago

I investigated the problem and

It seems that qgis store both if a layer should be expanded and if it should be visible. image (.qgs file content)

While lizmap consider all layers in the theme to be visible image (js dump of lizMap.config.themes['essentiel_google_sat'].layers)

I think that the visible attribute should be added here https://github.com/3liz/lizmap-web-client/blob/69f531559edb06549aa45804a4bf3ac3b6ad298a/lizmap/modules/lizmap/classes/qgisProject.class.php#L656 and an if condition should be added in switcher-layers-actions.js

If the fix is confirmed, I can propose a PR in the following days.

TeoGoddet commented 1 year ago

Hello, I'm really up to propose a fix if you confirm the problem. Have a nice day !

nboisteault commented 1 year ago

@TeoGoddet Hi, could you give us a link to a project or make a simple project with portable data which illustrate the issue?

TeoGoddet commented 1 year ago

Here is a sample project, test-lizmap.zip I made a PR #3640 but struggling to test it

nboisteault commented 1 year ago

Thanks @TeoGoddet !

In <visibility-preset>, I've never had a project with a layer having the parameter visible=0. If the layer was visible, it was in <visibility-preset> with visible=1. That's why I did not looked at this parameter. I saw that your project is from QGIS 3.26 so the behavior might have changed since 3.22 or maybe I missed the way to have this behavior. @TeoGoddet did you do something special?