Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Load layers as single WMS layer #3947

Merged
merged 6 commits into from
Mar 21, 2024
Merged

Conversation

mind84
Copy link
Contributor

@mind84 mind84 commented Oct 30, 2023

Allows to load project layers as single WMS Layer.

Feature description:

This development is intended to increase LZM performance when large projects containing many layers are loaded.
This option is presented as alternative to classic mode, and users should be able to switch from one mode to another by acting on the Lizmap plugin configuration.

Despite the performance improvements, some functionality are no longer available when a single layer is loaded, i.e.:

  • acting on the opacity of a single layer
  • define the image type of the single layer
  • turning off a layer is no longer immediate, but the system must reload the entire image
  • excluding cached map layers from the single WMS image breaks the layer tree order

Logics in detail

  • General
    I used the same classic layer map instance for loading the single WMS image. The advantage is that you can inherit the general configuration of the main map without duplicating it. If the main map useTileWms property is true , then the single WMS layer is loaded as TileWMS.

  • Baselayers
    All external baselayers and cached ones (WMTS) comes independently. Only Lizmap baselayers (i.e. loaded by QGIS server) are loaded in the singleWMS layer together with map layers.

  • Cached map layers
    All cached map layers (i.e. tiled WMTS layers) comes independently

  • Filtering features/ filtering by legend
    These two functionalities (alone or in combination) works also with single WMS layer

Consideration about layers order

As said, if some layer are tiled then they will be not included in the single WMS. This unfortunately has a very high chance of breaking the layers map order and there is no way (at least IMHO) to avoid this. I'll explain by an example the current layer order logic when single WMS is turned on.

Take for example the following layertree:

Layer tree
 Map layers
   Layer A -> classic layer, included in single WMS
   Layer B -> classic layer,  included in single WMS
   Layer C -> cached WMTS layer, excluded from single WMS
   Layer D -> classic layer,  included in single WMS
   Layer E -> cached WMTS layer, excluded from single WMS
 Baselayers
   OpenStreetMap (or Bing or whatever) -> excluded from WMS
   BaseLayer E -> Lizmap layer, included in single WMS

On the map, the real order is:

CASE WHEN you have selected the OpensStreetMap baselayer

Map order:
   --------- Cached layers block, ordered 
   Layer C
   Layer E
   --------- single WMS layers block, ordered
   Layer A
   Layer B
   Layer D
   --------- Baselayer
   OpenStreetMap (or Bing or whatever)

CASE WHEN you have selected the Lizmap BaseLayer E as baselayer

Map order:
   --------- Cached layers block, ordered 
   Layer C
   Layer E
   --------- single WMS layers block, ordered
   Layer A
   Layer B
   Layer D
   BaseLayer E
  ---------------

The base layers are obviously always placed at the bottom, but for the other two block I had to choose (arbitrarily, I would say) which one goes on top . IMHO there is no general right solution for this problem, but maybe you have a some suggestions about that.

Funded by Faunalia

@github-actions github-actions bot added this to the 3.7.0 milestone Oct 30, 2023
@mind84
Copy link
Contributor Author

mind84 commented Oct 30, 2023

Test notes:

Waiting for Lizmap plugin "single layer" option development, you can switch from a mode to another by adding the attached js file as custom js in media folder.

switch_to_single_layer.js.zip

For now, I've only added a test project single_wms_image.qgs.

e2e
I think it's best to wait for a first review before writing tests

Known failure on e2e tests when single Layer mode is turned on:

  • Tests related to opacity fails, since the opacity option is hidden and users can't act on it
  • some tests when comparison between screenshots is
    required (due to the fact that the image is loaded into a separate map)

UPDATE

These test notes are now outdated since the singleWMS configuration is loaded from project config

@github-actions github-actions bot added the tests unit tests and docker configuration for tests label Oct 30, 2023
@Gustry Gustry added frozen The release is soon, we wait for the next milestone to be available new feature sponsored development This development has been funded labels Oct 30, 2023
@rldhont
Copy link
Collaborator

rldhont commented Nov 2, 2023

Before doing some reviews, we need to decide where and how to store in the config this new option.

@Gustry @mdouchin Do we add wmsSingleLayer or wmsSingleMapLayer in options ?

@nboisteault nboisteault modified the milestones: 3.7.0, 3.8.0 Nov 2, 2023
@mdouchin
Copy link
Collaborator

mdouchin commented Nov 2, 2023

Before doing some reviews, we need to decide where and how to store in the config this new option.

@Gustry @mdouchin Do we add wmsSingleLayer or wmsSingleMapLayer in options ?

I would use wmsSingleRequestForAllLayers

Side idea: I think we should remove the active base layer (and obviously the externally requested WMS layers such as TMS) from the "single" image request. This would avoid having an empty map when zooming or panning (the base layer would come independently)

@mind84
Copy link
Contributor Author

mind84 commented Nov 2, 2023

Side idea: I think we should remove the active base layer (and obviously the externally requested WMS layers such as TMS) from the "single" image request. This would avoid having an empty map when zooming or panning (the base layer would come independently)

@mdouchin ,
For now baseLayer(s) are excluded from the single request. At least that's what I tried to do :)

@mind84 mind84 force-pushed the wms_single_layer branch 5 times, most recently from 77114f8 to 655893f Compare December 22, 2023 15:30
@mind84 mind84 force-pushed the wms_single_layer branch 2 times, most recently from e7f4956 to 294da5a Compare January 8, 2024 09:07
@mind84 mind84 force-pushed the wms_single_layer branch 2 times, most recently from 81b7dfd to 106c208 Compare January 24, 2024 13:10
@mind84 mind84 force-pushed the wms_single_layer branch 4 times, most recently from bee85d3 to 18ff742 Compare February 5, 2024 09:17
@Gustry Gustry removed the frozen The release is soon, we wait for the next milestone to be available label Feb 6, 2024
@Gustry Gustry added the run end2end If the PR must run end2end tests or not label Feb 19, 2024
assets/src/modules/config/Options.js Outdated Show resolved Hide resolved
assets/src/modules/config/Options.js Outdated Show resolved Hide resolved
assets/src/modules/config/Options.js Outdated Show resolved Hide resolved
tests/js-units/node/config.test.js Outdated Show resolved Hide resolved
assets/src/modules/Config.js Outdated Show resolved Hide resolved
assets/src/modules/Config.js Outdated Show resolved Hide resolved
assets/src/modules/Config.js Outdated Show resolved Hide resolved
assets/src/modules/map.js Outdated Show resolved Hide resolved
assets/src/modules/map.js Outdated Show resolved Hide resolved
assets/src/modules/SingleWMSLayer.js Outdated Show resolved Hide resolved
@mind84 mind84 force-pushed the wms_single_layer branch 2 times, most recently from c5d2f34 to a1a315d Compare March 10, 2024 10:06
assets/src/modules/config/Options.js Outdated Show resolved Hide resolved
assets/src/modules/map.js Outdated Show resolved Hide resolved
assets/src/modules/state/BaseLayer.js Show resolved Hide resolved
@mind84 mind84 force-pushed the wms_single_layer branch from a1a315d to 15c0884 Compare March 11, 2024 07:51
@rldhont rldhont requested review from Gustry and mdouchin March 11, 2024 09:43
@mdouchin
Copy link
Collaborator

@mind84 What about the WMS layers when the user has checked the checkbox Get images directly from WMS Server ?

I would not put them in the "single layer" group of layers, but I have no strong opinion about it. Any hint @Gustry @rldhont ?

@mind84
Copy link
Contributor Author

mind84 commented Mar 11, 2024

Hi @mdouchin!

What about the WMS layers when the user has checked the checkbox Get images directly from WMS Server ?

Right, I didn't consider that option.

In this case excluding it means that the layer will go on top.

@rldhont
Copy link
Collaborator

rldhont commented Mar 11, 2024

@mind84 What about the WMS layers when the user has checked the checkbox Get images directly from WMS Server ?

I would not put them in the "single layer" group of layers, but I have no strong opinion about it. Any hint @Gustry @rldhont ?

I think, if single layer is checked, then Get images directly from WMS Server is disabled.

@Gustry
Copy link
Member

Gustry commented Mar 11, 2024

I think, if single layer is checked, then Get images directly from WMS Server is disabled.

This is not done for now on the plugin side.

Copy link
Member

@Gustry Gustry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the UX point of view

@Gustry
Copy link
Member

Gustry commented Mar 19, 2024

I think, if single layer is checked, then Get images directly from WMS Server is disabled.

Can you make a ticket in plugin ?

@nboisteault Is this PR OK for you ?

Copy link
Member

@nboisteault nboisteault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mind84 Many thanks for this work. There is just those messages in the console to look at please:

simplescreenrecorder-2024-03-19_14.17.10.mp4

@mind84
Copy link
Contributor Author

mind84 commented Mar 19, 2024

@mind84 Many thanks for this work. There is just those messages in the console to look at please:

Yep, thanks, I'll fix it

@mind84 mind84 force-pushed the wms_single_layer branch from 15c0884 to b5b4e89 Compare March 19, 2024 15:45
@Gustry Gustry merged commit 9118d91 into 3liz:master Mar 21, 2024
12 of 13 checks passed
@mind84 mind84 deleted the wms_single_layer branch March 21, 2024 13:02
rldhont added a commit to rldhont/lizmap-web-client that referenced this pull request Apr 15, 2024
…le WMS Layer

After 3liz#3947 [Feature] Load layers as single WMS layer has been merged, the 3liz#4278 [Bugfix] Apply min and max resolutions to base layers has been partially loose.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement new feature run end2end If the PR must run end2end tests or not sponsored development This development has been funded tests unit tests and docker configuration for tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants