})
];
- layers[0].addTo(map);
+ for (var i = layers.length - 1; i >= 0; i--) {
+ if (i === 0 || params.layers.indexOf(layers[i].options.code) >= 0) {
+ map.addLayer(layers[i]);
+ break;
+ }
+ }
map.noteLayer = new L.LayerGroup();
map.noteLayer.options = {code: 'N'};
}).addTo(map);
}
- if (params.layers) {
- var foundLayer = false;
- for (var i = 0; i < layers.length; i++) {
- if (params.layers.indexOf(layers[i].options.code) >= 0) {
- map.addLayer(layers[i]);
- foundLayer = true;
- } else {
- map.removeLayer(layers[i]);
- }
- }
- if (!foundLayer) {
- map.addLayer(layers[0]);
- }
- }
-
if (params.marker) {
L.marker([params.mlat, params.mlon], {icon: getUserIcon()}).addTo(map.markerLayer);
}