【问题标题】:leaflet layer group default value传单图层组默认值
【发布时间】:2019-09-27 08:55:58
【问题描述】:

我在底图上有 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】:

    我修好了

        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);
    
       // just  add any layer you would like , 
    
        this.map.addLayer(this.weather)
    
    /// then rest of layers here 
        L.control.layers(mixed,null,{collapsed:false} ).addTo(this.map);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-08
      • 1970-01-01
      • 2018-01-08
      • 1970-01-01
      • 2015-12-30
      • 2016-09-16
      • 1970-01-01
      • 2011-01-03
      相关资源
      最近更新 更多