mapboxgl-legend icon indicating copy to clipboard operation
mapboxgl-legend copied to clipboard

Layers group

Open sylvain258 opened this issue 1 year ago • 1 comments

Hello,

Is it possible to group layers ? For example, layers relative to demography together, layers relatives to the nature together etc.

Thank you for your feedback,

Sylvain Becquaert

sylvain258 avatar Aug 08 '24 11:08 sylvain258

Panels are created from the layers you define in Mapbox. As long as there are different layers, it's not possible to group them right now.

That said, there's the option to toggle multiple layers with a single toggler. Hope this helps.

const legend = new LegendControl({
  layers: {
    lakes: true,
    rivers: {
      toggler: ['rivers', 'lakes'],
    },
  },
})

markusand avatar Aug 09 '24 18:08 markusand