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

use last used WMS image encoding when adding WMS layers from Browser dock (fix #57666) #60221

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alexbruy
Copy link
Contributor

Description

When adding a WMS layer from the Data Source Manager one can choose which image encoding to use. The list of available encodings is generated from the server response and image formats supported by the provider. By default the first image encoding reported by the server is used if it is supported by the provider. Otherwise QGIS will try to use encoding defined by setting qgis/WMSDefaultFormat if it is present and supported by the provider.

On the other hand, when adding a WMS layer via drag-and-drop from Browser dock, it is always added using image/png encoding. Both server capabilities and qgis/WMSDefaultFormat setting are ignored. This happens not only because
Browser picks the first image encoding supported by the provider which is also supported by the server, but also because drop handler in the QGIS app class overwrites it with the last used WMS imnage encoding defined by /qgis/lastWmsImageEncoding setting.

QGIS/src/app/qgisapp.cpp

Lines 5635 to 5636 in ef0dd03

// Use the last used image format
QString lastImageEncoding = QgsSettings().value( QStringLiteral( "/qgis/lastWmsImageEncoding" ), "image/png" ).toString();

The setting /qgis/lastWmsImageEncoding is not updated anywhere in the codebase and the image/png is always used.

Proposed PR unifies image encoding selection between WMS source select dialog and Browser in a following way:

  • when adding a WMS layer via Data Source Manager we update /qgis/lastWmsImageEncoding setting with the used image encoding
  • Browser and Data Source Manager will try to use as a default the first image encoding from the capabilities supported by the server and provider

Fixes #57666.

Copy link

github-actions bot commented Jan 22, 2025

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit a174cbd)

🪟 Windows builds

Download Windows builds of this PR for testing.
Debug symbols for this build are available here.
(Built from commit a174cbd)

@alexbruy alexbruy force-pushed the browser-wms-image-encoding branch from ef5ca2e to a174cbd Compare January 22, 2025 14:15
@agiudiceandrea
Copy link
Contributor

Shouldn't this PR be backported to release-3_40?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WMS layers added with the browser panel ignore image format preferences and default to PNG
2 participants