How to add layer-group into control-layers
See original GitHub issueIn official documentation, Leaftlet shows me to use L.control.layers(baseMaps, overlayMaps).addTo(map); to add baseMaps and overlayMaps to control layer. How can I do that with l-layer-group and l-control-layers?
I checked the example, it has the only baseMaps option.
Make an example, I want to add this layer group, it is a set of markers, how do I add another checkbox on control-layers to become overlayMaps?
<l-tile-layer
layerType="base"
name="Default Base"
:url="url"
/>
<l-layer-group :visible="sourceVisible">
<l-marker
v-for="(item, index) in sources"
:key="index"
:lat-lng="[item.coordinates[1], item.coordinates[0]]"
:icon="sourceIcon(item.icon)"
@l-click="onClick(item)"
>
</l-marker>
</l-layer-group>
Thank you.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:23 (3 by maintainers)
Top Results From Across the Web
adding layers in layer group dynamically to layer control in ...
In your ajax callback, you should find layerGroup = L.layerGroup() .addLayer(vector1)) .addLayer(vector2)) .addLayer(vector3)) .
Read more >Layer Groups and Layers Control - Leaflet - Leaflet
This tutorial will show you how to group several layers into one, and how to use the layers control to allow users to...
Read more >How to add layers and update layer control dynamically : leaflet
There are public methods in L.Control.Layers control to add base layers and overlays dinamically (see full reference):.
Read more >L.LayerGroup
Used to group several layers and handle them as one. If you add it to the map, any layers added or removed from...
Read more >Layers control | React Leaflet
</Marker>. </LayersControl.Overlay>. <LayersControl.Overlay checked name="Layer group with circles">. <LayerGroup> ... <Popup>Popup in FeatureGroup</Popup>.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi @sangdth,
The documentation is far from perfect and I want to add many examples of the official documentation to Vue2Leaflet documentation but didn’t have the time yet. You can add overlay to your control like this:
Let me know if this helps.
Micka
Hi @mujahidinside,
You must add
for layers to be added as overlay layers in the control.