Support WMS layer style in legend URL generation#52
Merged
ronitjadhav merged 3 commits intomainfrom Mar 5, 2026
Merged
Conversation
29808de to
e6f9079
Compare
7 tasks
jahow
reviewed
Mar 5, 2026
Member
jahow
left a comment
There was a problem hiding this comment.
thank you! please remember that the examples need to be as concise as possible for them to be useful!
Member
Author
|
Thanks for the review. I've made the changes as suggested. |
jahow
approved these changes
Mar 5, 2026
Member
jahow
left a comment
There was a problem hiding this comment.
Looking good! just a small suggestion on the example code
- Use updateLayerInContext util for style switching - Use DEFAULT_CONTEXT for base map setup - Derive view from WMS layer using createViewFromLayer - Fetch styles dynamically from WMS GetCapabilities - Check style !== undefined instead of truthy
6dbb651 to
99fb3d9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
WMS supports multiple named styles for a layer. When switching the style of a WMS layer (e.g. via the
styleproperty onMapContextLayerWms), the map renders the correct style — but the legend always showed the default style's legend graphic.This happened because
createWmsLegendUrlwas not including theSTYLE=parameter in theGetLegendGraphicrequest. Without it, the WMS server always returns the legend for the default style.Solution
"STYLE"to theremoveSearchParamslist to strip any existingSTYLEparam from the input URLlayer.styleis set, includeSTYLE=<value>in theGetLegendGraphicURLExample
Example-Legend.vue) that shows a WMS layer with style switching — the legend updates when the style changes