walkermatt / ol-layerswitcher

Layer control for OpenLayers
MIT License
384 stars 176 forks source link

No issue / qestion for improvement: Can legend symbol be added to the layer switcher? #498

Open pggsn opened 1 year ago

pggsn commented 1 year ago

Hi Matt,

I am wondering if it is possible to add legend symbol to the layer switcher in between of the checkboxes and the layer title like it is in QGIS. Do i need to change the ol-layerswitcher.js for it or is it "just" some additional code in the css/html and the js that includes the code for my layerswitcher components?

Best, Kim

richard-thomas commented 1 year ago

Hi Matt, I too would be curious about your thoughts on this as I have implemented this with ol-LayerSwitcher (example here if you follow the "web page" link from ol-sld-styler LayerSwitcher example) by overriding the HTML/JS after an ol-LayerSwitcher instance has been created. I was keen to pull in the latest ol-layerswitcher rather than fork it to keep up with your fixes/improvements (especially with OL7!) Probably worth saying that my code is focused on building web maps from QGIS-exported (data +) SLD styles, so wouldn't build from existing OL styles/styleFunctions. However, there isn't really anything intrinsically dependent on SLD input in my showLayerSwitcherSymbols() method other than where it currently extracts the minscaledenominator/maxscaledenominator from in order to italicize & grey out symbols in the LayerSwitcher that are not visible at current map scale.