I would like to implement the GroupedLayerControl plugin to my leaflet map.
Unfortunately, after applying the L.control
it stops working.
My layers look as this:
var maptiles = {
"OpenStreetMap": osm,
"Hybrid": hybridMutant
};
var overlays = {
"Eclipses" :{
"Annular" : annular,
"Hybrid" : hybrid,
"Total" : total
},
"Places" : {
"Places": places
}
};
I've tried:
var layers = L.control.groupedLayers(maptiles, overlays);
map.addControl(layers);
and
L.control.layers(maptiles, overlays).addTo(map);
neither first nor second example was working. After this code, the map is crashed and I see only the OpenStreetMap canvas and everything, which is above this line of code.
I've checked the console, which for the first case says:
Uncaught TypeError: Cannot read property '_leaflet_id' of undefined
https://github.com/Leaflet/Leaflet/issues/1074
https://github.com/stefanocudini/leaflet-panel-layers/issues/6
and for the second one:
Uncaught TypeError: Cannot read property 'minZoom' of undefined
discussed also here:
L.control.layers: Uncaught TypeError: Cannot read property 'minZoom' of undefined
Is there something wrong with my layers? I've defined variables, which include a bunch of separate .geojson layers.
Full JSfiddle is here:
https://jsfiddle.net/okezw4dL/