我的传单地图有两层:1.温度,2.风全局 我想将第2层置于顶层,但我的JavaScript以下代码无效
var layerControl = L.control.layers(null, {
"temperature": bandsWindLayer,
}).addTo(map);
$.getJSON('wind-global.json', function (data) {
var velocityLayer = L.velocityLayer({
displayValues: true,
displayOptions: {
velocityType: 'Global Wind',
displayPosition: 'bottomleft',
displayEmptyString: 'No wind data'
},
data: data,
maxVelocity: 15
});
layerControl.addOverlay(velocityLayer, 'Wind-Global');
})
map.on("overlayadd", function (event) {
velocityLayer.bringToFront()
bandsWindLayer.bringToBack()
});
我的错误消息是“未定义velocityLayer”