Skip to content

Re-design what mapml-viewer does with LegendURL / GetLegendGraphic links #524

Description

@prushforth

WMS and other OGC mapping services provide legend information via linked graphics, typically but not necessarily images.

In the original implementation of this custom element, I wasn't sure what to do with this information, but I wanted to expose it, so I included a <a href="LegendURL">Layer name/title/label</a> in the <details>' <summary> that represents the layer in the layer control.

It seems possible that browsers will in future disallow such interactive content in the <summary> elements, so this issue is where we can discuss and design what to do with the (set of possible) LegendURL or GetLegendGraphic links (or equivalents) that may be available for a map layer. Currently these can be represented by DOM elements such as

<map-link rel="legend" href="LegendURL"></map-link>

but the question remains as to how to expose them to the developer, if not the user, in an accessible manner.

Activity

  1. prushforth commented on Jan 28, 2026

    @prushforth
    MemberAuthor

    At LEAST, the legend graphic for the <map-layer> should be rendered into a disclosure widget beneath the layer Opacity disclosure widget, before the sub-layers.

    There's a related problem, however in that a map layer often has more than a single style, and for each style one can have at least one legend graphic, if not more than one due to support for multiple formats. png, jpeg, svg etc. Given that the style of a map is currently under the control of a <map-select> value, we must think of how to assign a legend link dynamically as the user changes selection. Perhaps <map-link rel="legend" tref="...style={style}.." > within a parent '`. tbd

  2. added this to the 2026 milestone on Jan 28, 2026
  3. AliyanH commented on Jun 30, 2026

    @AliyanH
    Member

    Hi @prushforth,

    I played around with three possible placements for legend graphics, would love to hear your thoughts!

    Option 1 - Legend appears in the layer settings, as a disclosure widget beneath layer Opacity disclosure widget
    Image

    Option 2 - Legend appears in the layer settings, before the Opacity disclosure widget in a div
    Image

    Option 3 - Legend appears outside the layer settings beneath the layer title, and is displayed as soon as the layer menu is opened
    Image

  4. prushforth commented on Jun 30, 2026

    @prushforth
    MemberAuthor

    I think I favour the disclosure widget approach. At some point I think we'll want to have a parameterized Legend (by style, principally) underneath Sub-layer, so a disclosure widget seems portable to that location as well. I've been working on a legend example for gcds-map, and I realized that opening a plain image in another tab doesn't do much for non-visual users (to understate it).

    Thanks for tackling this!

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions