CloudMade/Leaflet — Issue #496: Force layers to draw in other (than standard) Map panes
Author: markieta
Created: 2012-02-16 05:45:43+00:00
State: open

Leaflet maintains that the Map panes elements contain all layers added to the map. The difference between many of the Map panes is strictly the z-index order of layering.

I would like to use a combination of lvector.CartoDB layers, which are essentially `overlayPane` layers, with TileLayer, such as GeoIQ Acetate-bg and labels.

This is the ordering of the elements as they are added the map:

tileLayer1 = new L.TileLayer();
map.add(tileLayer1); // add first layer to map

cartoDBLayer1 = new lvector.CartoDB();
cartoDBLayer.setMap(map); // add second layer to map

tileLayer2 = new L.TileLayer();
map.add(tileLayer2); // add third layer to map

What returns is a map with layers in this order:

tileLayer1,tileLayer2,cartoDBLayer1

`tileLayer1` and `tileLayer2` are situated in the `HTMLElement: TilePane` and `cartoDBLayer1` is in `HTMLElement: overlayPane`.

Is there any way to force `cartoDBLayer1` to render in the TilePane, such that it falls in order of the z-index that it is added to the map in...

i.e.

z-index[0]:tileLayer1
z-index[1]:cartoDBLayer1
z-index[2]:tileLayer2

My use case example would be the ability to stack my layers as so:

acetate-labels
vector layer
acetate-bg