Question 1: With mapbox.js 2.3.0 (not sure what LeafLet version), are CircleMarkers supposed to go into the overlay pane by default, and Markers into the marker pane?
I basically have 3 sets of objects (labels, contours, points), which I'd like to display in the following z-index order (i.e. bottom to top): contours < labels < points.
My points are CircleMarkers and labels are Markers. If both were in the same pane, I could manipulate the z-index of each at instantiation. But since contours and points are in the overlay pane, and the labels in the marker pane, and LeafLet makes the z-index of the marker pane much higher than that of the overlay pane, the order I get is: contours < points < labels.
I saw this thread, whose best answer suggests to manipulate the z-index of the panes via CSS. The issue with that is that I end up with: labels < contours < points. It is better but not ideal, so...
Question 2: is there a more robust way of manipulating the z-index of CircleMarkers and Markers? It is irrelevant to me which panes they land on.
Below is how I instantiate points and labels, if it helps:
// Labels:
L.geoJson(file , {
onEachFeature: function(feature, polygon) {
var myIcon = L.divIcon({
className: 'iconCSS',
html: "<div class=areaLabel>" + feature.properties.LAD13NM + "</div>"
});
var label = L.marker(polygon.getBounds().getCenter(), { icon: myIcon });
map.addLayer(label);
}
});
// Points:
L.geoJson(file, {
onEachFeature: function(feature, point) {
var station = L.circleMarker(point.getLatLng());
map.addLayer(station);
}
});