function layerService() {
var ul = 'http://192.168.0.118:8090/iserver/services/map-ChangSha_ZHGL/rest/maps/ZHGL';
new ol.supermap.LayerInfoService(ul).getLayersInfo(function (serviceResult) {
serviceResult.result.subLayers.layers.map((layer)=>{
if (layer.name === 'XB_P@GuanLang') {
layer.visible = 'false'
}
});
var xx = serviceResult.result
var layersInfo = new SuperMap.SetLayersInfoParameters({
isTempLayers: false,
layersInfo: xx,
});
new ol.supermap.LayerInfoService(ul).setLayersInfo(layersInfo, function (res) {
// console.log(1);
console.log(res.result.newResourceID);
var layertest = [
new ol.layer.Tile({ //管廊底图
source: new ol.source.TileSuperMapRest({
url: ul,
layersID :res.result.newResourceID,
wrapX: true
}),
projection: 'EPSG:3857'
}),
];
map.addLayer(layertest);
});
});
}
我把服务的其中一个子图层 'XB_P@GuanLang' 设置了不可见,然后请问我怎么把设置后的信息同步到页面上,简单说就是:用Openlayer 怎么选筛选图层
就像右侧那样的操作 ,谢谢大家了!