我在基本地图上有4层叠加组,我需要使天气组图层在地图上处于默认选择状态。
this.weather = L.layerGroup()
this.wind = L.featureGroup()
this.humd = L.layerGroup();
this.rain = L.layerGroup();
// Base-Maps with Overlayes
var mixed = {
"Grayscale": grayscale, // BaseMaps
"Streets": streets, // BaseMaps
"Metro": metro, // BaseMaps
"weather": this.weather, // OverlayMaps
"wind": this.wind, // OverlayMaps
"humd": this.humd, // OverlayMaps
"rain": this.rain, // OverlayMaps
};
this.map = new Map('mapId').setView([33, 44], 6);
tileLayer('https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}
{r}.png', {
attribution: '2019 © منظومة ارصاد العراق',
minZoom: 5,
maxZoom: 6
}).addTo(this.map);
L.control.layers(mixed).addTo(this.map);
i固定
this.map = new Map('mapId').setView([33, 44], 6);
tileLayer('https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png', {
attribution: '2019 © منظومة ارصاد العراق',
minZoom: 5,
maxZoom: 6
}).addTo(this.map);
this.map.addLayer(this.weather)
L.control.layers(mixed,null,{collapsed:false} ).addTo(this.map);