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

Map legend must use style title if available #7409

Closed
giohappy opened this issue Apr 28, 2021 · 0 comments
Closed

Map legend must use style title if available #7409

giohappy opened this issue Apr 28, 2021 · 0 comments
Assignees
Labels
enhancement frontend Issues regarding Frontend and styling
Milestone

Comments

@giohappy
Copy link
Contributor

Now that style titles have been fixed (#7405) we need to use them (if available).
MapLayer.get_legend must return the title as the dictionay keys, if it's available, otherwise it will use the style name.

try:
layer_params = json.loads(self.layer_params)
capability = layer_params.get('capability', {})
# Use '' to represent default layer style
style_name = capability.get('style', '')
layer_obj = Layer.objects.filter(alternate=self.name).first()
if ':' in style_name:
style_name = style_name.split(':')[1]
elif layer_obj.default_style:
style_name = layer_obj.default_style.name
href = layer_obj.get_legend_url(style_name=style_name)
return {style_name: href}

@giohappy giohappy added the backport 3.2.x PR should be backported to target version label Apr 28, 2021
@giohappy giohappy added this to the 3.2 milestone Apr 28, 2021
@afabiani afabiani added enhancement frontend Issues regarding Frontend and styling and removed backport 3.2.x PR should be backported to target version labels Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement frontend Issues regarding Frontend and styling
Projects
None yet
Development

No branches or pull requests

3 participants