Leaflet Layer Control: select Layer inside Layer G

2019-06-28 05:24发布

问题:

I would like to have a Leaflet Layer Control where I can select one of the base layers, and have this base layer itself be a LayerGroup from which I can select sublayers to display. I'm thinking of a setup where I click a radio button to select the base layer (the layer group), and under that I would then see a list of checkboxes for which layers within that to show. Is there a way to do this using the stock Layer Control?

I looked for examples and thumbed through the Leaflet API but didn't find anything like this.

回答1:

There is currently no Leaflet support for layer hierarchies beyond the LayerGroup level. You could use the Leaflet.GroupedLayerControl plugin to achieve some basic grouping in the layer control panel, but not an actual hierarchy.



标签: leaflet