In the leaflet, the z-index of the panels is set automatically.
I believe this:
- popup panel
- marker bar
- overlay panel
- tile
top down
the overlay panel is the layer of your polygon. if you change the z-index of the marker panel behind the overlap panel, then your markers should appear behind your polygons.
see this code for an example.
http://codepen.io/anon/pen/MKvZZa
CSS
#map{width:400px;height:400px;} .label{background-color:white;} .leaflet-marker-pane{ z-index:2 }
JavaScript:
var map = L.map('map').setView([51.505, -0.09], 13); var accessToken='insert your mapbox access token here'; var mapboxTiles = L.tileLayer('https://api.mapbox.com/v4/mapbox.streets/{z}/{x}/{y}.png?access_token=' + accessToken, { attribution: '<a href="http://www.mapbox.com/about/maps/" target="_blank">Terms & Feedback</a>' }); mapboxTiles.addTo(map); var circle = L.circle([51.508, -0.11], 500, { color: 'red', fillColor: '#f03', fillOpacity: 0.5 }).addTo(map) var myIcon = L.divIcon({ iconSize: [70, 20], iconAnchor: [35, 10], className: 'label', html: '<div>' + 'test label' + '</div>' }) L.marker([51.508, -0.11], { icon: myIcon }).addTo(map);
source share