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

feat: enable automatic style creation for wms layers' getLegendGraphic #1578

Merged
merged 3 commits into from
Aug 17, 2022

Conversation

Grammostola
Copy link
Contributor

Proposes to fix #1560 . Introduces two properties of a WMS layer:

      "hasThemeLegend": true,
      "legendParams" : {
        "scale" : 5000,
        "legend_options" : "dpi:300"
      }

Where hasThemeLegend is necessary for "auto" style creation for WMS layers with a theme legend (to extendedLegend) and
legendParams is more or less what @steff-o suggested in the related issue.

Both properties are ignored if a style property also exists for the given WMS layer.

The default "scale" for the getLegendGraphic call (there needs to be a scale for scale dependant styles) is the largest scale of the configured map (because typically theme layers have more visible classes at a larger scale than at a smaller scale if scale dependant) however that value is overriden if scale is given as a legendParam.

The possibility exists to make hasThemeLegend part of the legendParams object but it's slightly easier to merely define the hasThemeLegend property rather than it as part of an object if no special legendParams as per getLegendGraphic() are to be employed.

@jokd
Copy link
Contributor

jokd commented Aug 8, 2022

Tested and LGTM

@Grammostola
Copy link
Contributor Author

Currently this pr sets the styleName property of a layer while its style property remains 'default'. In comparison the same layer with a style given in index.json will have both the style and styleName property as the name of that style. (layer.js does
layerOptions.styleName = layerOptions.style;)
At a glance I don't see any layer.get('style') references in the origo client, merely layer.get('styleName') so I don't know whether this makes a difference however I can see the logic in making these auto-default-WMS-layers identical to entering a style manually for them. Any thoughts on this?

@tonnyandersson
Copy link
Collaborator

@Grammostola Quagmire.

@jokd
Copy link
Contributor

jokd commented Aug 15, 2022

I guess we can live with that

@Grammostola
Copy link
Contributor Author

Answers clear as glass
Understanding rolling in
So shall it be now

🦦

@jokd jokd merged commit 2e45974 into master Aug 17, 2022
@jokd jokd deleted the autostyle_wms branch August 17, 2022 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use style from WMS server
3 participants