我创建了下拉列表,现在从动态地图服务中获取所有图层 我只是试图在地图上显示由下拉列表选择的选定图层,并在选择下一个图层时删除所有上一个图层。
var removlayr = [bloc, majortown, landlocatn, hotsprig, erthquak, distHq, raiway, national, majorroads, geologi, drain, activ, wind, water, tecton, landl, earthzone, ste, distr];
var i;
for(i = 0; i < removlayr.length; i++)
{
map.removeLayer(removlayr[i]);
}
removlayr.length = 0;
alert("layer Removed");