watergis / maplibre-gl-legend

This module adds legend control which is able to create legend panel from mapbox style to maplibre-gl-legend
https://maplibre-gl-legend.water-gis.com/
MIT License
31 stars 7 forks source link

Group layers so they can be swithced on/off together #27

Open apanagio opened 2 months ago

apanagio commented 2 months ago

Is your feature request related to a problem? Please describe. I'd like to have two or more layers with a single legend, so that they can be shown / hidden together. Currently this cannot be done.

Describe the solution you'd like A solution could be to show one legend for layers that have the same label.

Describe alternatives you've considered I cosidered this: https://github.com/developmentseed/mapbox-gl-layers, but it doesn't seem to work

Additional context A common pattern when you want to make a line layer easily clickable, is to add an additional layer with opacity 0.01 and much bigger line-width. You don't want an extra legend for that layer and you'd want to toggle the two layers together