Only add layer with key to swicher if key configured (#145)

This commit is contained in:
Norbert Renner 2019-06-24 12:46:54 +02:00
parent 08dacd8c3d
commit bb097c6c5b

View file

@ -135,7 +135,13 @@ BR.LayersConfig = L.Class.extend({
var layerData = BR.layerIndex[layerId]; var layerData = BR.layerIndex[layerId];
if (layerData) { if (layerData) {
layers[layerData.properties.name] = this.createLayer(layerData); // when key required only add if configured
var keyObj = this.getKeyName(layerData.properties.url);
if (!keyObj || (keyObj && BR.keys[keyObj.name])) {
layers[layerData.properties.name] = this.createLayer(
layerData
);
}
} else { } else {
console.error('Layer not found: ' + layerId); console.error('Layer not found: ' + layerId);
} }