Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/390.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 地图盒/传单上的图层控件和geojson_Javascript_Leaflet_Mapbox - Fatal编程技术网

Javascript 地图盒/传单上的图层控件和geojson

Javascript 地图盒/传单上的图层控件和geojson,javascript,leaflet,mapbox,Javascript,Leaflet,Mapbox,我搞混了 及 使用tiles的layers控件,我没有问题,它工作得很好,但我需要使用geojson,这就是我的问题: gejson层始终位于前台,而平铺在后台。 但我需要在layercontrol中选择一个“streets”平铺时,它位于前台,而l.geojson位于后台。 我需要它来显示标签。使用Trasparence对我的目的不好。 有解决办法吗? 下面是代码的一部分: var mapdataviz = L.mapbox.map('map', 'andria.h41061in')

我搞混了

使用tiles的layers控件,我没有问题,它工作得很好,但我需要使用geojson,这就是我的问题: gejson层始终位于前台,而平铺在后台。 但我需要在layercontrol中选择一个“streets”平铺时,它位于前台,而l.geojson位于后台。 我需要它来显示标签。使用Trasparence对我的目的不好。 有解决办法吗? 下面是代码的一部分:

  var mapdataviz = L.mapbox.map('map', 'andria.h41061in')
   .setView([39.0981, 16.5619], 8);
 mapdataviz.legendControl.addLegend(document.getElementById('legend-content').innerHTML);


  L.control.layers({
    'city': L.mapbox.tileLayer('andria.cal_com_ief1'),
    'com_geojson': L.geoJson(comData,  {
      style: getStyle,
      onEachFeature: onEachFeature
  }).addTo(mapdataviz),
    'streets': L.mapbox.tileLayer('andria.h41061in')
},
 {
    'streets': L.mapbox.tileLayer('andria.h41061in'),

     'com_geojson': L.geoJson(comData,  {
      style: getStyle,
      onEachFeature: onEachFeature
  }).addTo(mapdataviz),
    'bounds': L.mapbox.tileLayer('andria.cal_conf')
}).addTo(mapdataviz);



  var popup = new L.Popup({ autoPan: false });

  // comData comes from the 'us-states.js' script included above
  var comLayer = L.geoJson(comData,  {
      style: getStyle,
      onEachFeature: onEachFeature
  })

  function getStyle(feature) {
      return {
          weight: 0.7,
          opacity: 0.5,
          color: 'white',
          fillOpacity: 0.8,
          fillColor: getColor(feature.properties.IEF1_2008)
      };
  }

您提到透明度不适合您的目的,但本MapBox教程演示了如何将geoJson层置于街道地图层之后

这有用吗