【发布时间】:2014-03-20 17:57:41
【问题描述】:
使用带有瓷砖的图层控制,我没有问题,它工作得很好,但我需要使用 geojson,这是我的问题: gejson 层总是在前景和背景上的瓷砖。 但我需要在 layercontrol 中选择“街道”图块时,它会出现在前景中,而 l.geojson 会出现在背景中。 我需要它来显示标签。使用透明度对我的目的不利。 任何解决方案? 这里是部分代码:
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)
};
}
【问题讨论】:
标签: javascript leaflet mapbox