Leaflet : add layerGroup to specific pane

307 Views Asked by At

This below code doesn't seem to work, as every layer contained in my fournituresLayer groupLayer still have 'overlay pane' as reference.

let map = L.map('map', {
    crs: L.CRS.Simple,
    attributionControl: false,
    dragging: true,
    keyboard: true,
}).setView([0, 0], 20);

map.createPane('fournituresPan')
map.getPane('fournituresPan').style.zIndex = 450;
map.getPane('fournituresPan').style.pointerEvents = 'none';

let buildingLayer = L.layerGroup([])
let fournituresLayer = L.layerGroup([], { pane : 'fournituresPan'})
let electricityLayer = L.layerGroup([])

Do anybody know how to add a layerGroup to a specific Pane ?

1

There are 1 best solutions below

0
renaud H On

Just set the PaneName with option 'pane' when you add your LayerGroup to the map

    L.layerGroup([], { pane: 'markerPane' }).addTo(this.map)