【解决办法】使用临时图层支持过滤图层元素,可以参考博客https://blog.csdn.net/supermapsupport/article/details/52943780 实现;openlayers参考代码如下:
const layerStatusParameters = new ol.supermap.SetLayerStatusParameters({
layerStatusList: [
new ol.supermap.LayerStatus({
// layerName: 'chengdu@SiChuan',
layerName: 'chengdu@SiChuan#1',
isVisible: true,
displayFilter: "区县名称='双流区' or 区县名称='新都区'"
})
]
})
new ol.supermap.LayerInfoService(url).setLayerStatus(layerStatusParameters, function (createTempLayerEventArgs) {
tempLayerID = createTempLayerEventArgs.result.newResourceID
console.log(tempLayerID)
const TempLayerLayer = new ol.layer.Tile({
source: new ol.source.TileSuperMapRest({
url: url,
layersID: tempLayerID,
wrapX: false,
extent: [102.99, 30.09, 104.9, 31.44]
})
})
map.addLayer(TempLayerLayer)
})