Closed plattdl closed 8 years ago
Hi @plattdl
Just add legend attribute to layers, this should be a HTML string.
Example:
layers: {
...
overlays: {
layer1: {
type: 'xyz',
url: 'http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png',
name: 'Positron',
legend: '<h2>this is HTML string</h2>'
}
}
}
I am using the layer control and have noticed in the code that there is a legend toggle functionality for each layer. However I can not find any examples on how to supply legend data to each layer so that the control can toggle the legend.
Can someone provide some guidance on how to use this functionality?