markers shared by multiple layers member of L.Control.Layers are disabled even if the remaining layers include them
See original GitHub issueIn leaflet 0.3.1, when the same marker is added to more than one layer, all of which are added to L.Control.Layers as overlays, and one of the overlays is disabled, the marker is disabled.
e.g.
var groupA = new L.LayerGroup(),
groupB = new L.LayerGroup();
map.addLayer(groupA).addLayer(groupB);
var overlays = {
"A features": groupA,
"B features": groupB,
};
map.addControl(new L.Control.Layers(null, overlays));
var marker = new L.Marker(new L.LatLng(1.0, 1.0));
groupA.addLayer(marker);
groupB.addLayer(marker);
Now, whenever the “A features” overlay is disabled, the marker is removed, even if the “B features” overlay is still enabled. Disabling and re-enabling “B features” does re-add the marker.
Issue Analytics
- State:
- Created 11 years ago
- Reactions:3
- Comments:7 (3 by maintainers)
Top Results From Across the Web
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 >Filtering on multiple features with the use of L.control.layers so ...
To dynamically change GeoJSON layer filter with L.control.layers control, dummy nodisplayed layers can be used. These layers are used:.
Read more >Leaflet for R - Show/Hide Layers - GitHub Pages
The Leaflet package includes functions to show and hide map layers. ... to individual markers and shapes, etc., while groups are used to...
Read more >OpenLayers Examples
Example of ordering layers using Z-index. Layer Zoom Limits (layer-zoom-limits.html). Using minZoom and maxZoom to control layer visibility. Lazy Source
Read more >NVIDIA Deep Learning TensorRT Documentation
TensorRT ships with a library of plug-ins, and source for many of these and ... DLA and the rest on GPU; for layers...
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 FreeTop 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
Top GitHub Comments
I wrote a workaround that does the trick for me. Perhaps this new behaviour should be hidden behind some forceReadd option or something, otherwise I might think its performance impact is not welcome.
@MaxiPigna I think the workaround is in the cross-referenced commit here: https://github.com/rgeissert/Leaflet/commit/e273f1bb0aeef485d07c2814429a28ea9ea07474