传单图层组默认值

问题描述 投票:0回答:1

我在基本地图上有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);
leaflet layer
1个回答
0
投票

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);
© www.soinside.com 2019 - 2024. All rights reserved.