When I add a layer in leaflet it stays automatically above all layers I want layers to be ordered wich one stays above the other in way that last added layer will not stays above and hide the other layers that may I have interaction with them (mouse :click,out,move…).
here my example order layers leaflet
[GIS] Setting (above/under) priority order of layer in leaflet
layersleafletorder
Related Question
- [GIS] Trigger a layers ‘on hover’ effect through another layer in Leaflet
- [GIS] Leaflet Layer Controls
- [GIS] Split Leaflet layer control into multiple tabs panel
- [GIS] How to change the order of layers in a Leaflet map
- QGIS Layer Sorting – How to Sort Layer Order Based on Mixed String/Numerical Names in PyQGIS
Best Answer
You can work with
layer.bringToFront()
,bringToBack()
orsetZIndex()
to reorder your layers.If you want one layer to always be below all others you can listen for the layer's
add
event and then bring it to the back (and bring the other to the front the same way):Demo here: http://plnkr.co/edit/6c7xxWZpv3J8oTiyjG7Q