在创建临时图层时,发现其执行的
layerStatusParameters 参数中各图层的可见性只有 isVisble字段有效,
displayFilter字段无论如何设置都无法影响图层可见性,也不会报错。
没有切片,直接发布的,就几百个图斑,生成临时图层时用visible控制子图层显示隐藏都是正常的,但是设置
displayFilter属性却怎么都没效果,无论写啥都是全部显示,和没写一样。
筛选的字段确定是存在原来所有要素中的,对应的属性值也存在。
displayFilter="CITY = 第十四师"
var layerStatusParameters2 = new SuperMap.SetLayerStatusParameters(); layerStatusParameters2.resourceID = null; layerStatusParameters2 = getLayerStatusList(layerStatusParameters2); console.log("图层可见状态",layerStatusParameters2) var setLayerStatusService2 = new SuperMap.SetLayerStatusService(url2); setLayerStatusService2.events.on({ "processCompleted": setLayerStatusCompleted, "processFailed": setLayerFailed }); for(let value of layerStatusParameters2.layerStatusList){ value.displayFilter=displayFilter } console.log("显示图层时的筛选条件",layerStatusParameters2) setLayerStatusService2.processAsync(layerStatusParameters2);
请问有解决方案吗?因为包含多个子图层,另一个getFeaturesBySQL方法不能用,这个生成临时图层的方法 筛选参数
displayFilter又无效。无法解决
你好,我这边测试openlayer使用iserver渲染临时图层,并且控制可见和属性过滤是正常的,您可以使用我的测试代码对比一下问题。
<!--******************************************************************** * Copyright© 2000 - 2022 SuperMap Software Co.Ltd. All rights reserved. *********************************************************************--> <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title data-i18n="resources.title_tiledMapLayer4326"></title> <script type="text/javascript" src="../js/include-web.js"></script> <script type="text/javascript" src="../../dist/ol/include-ol.js"></script> </head> <body style="margin: 0; overflow: hidden; background: #fff; width: 100%; height: 100%; position: absolute; top: 0"> <div id="map" style="width: 100%; height: 100%"></div> <script type="text/javascript"> var map,layer, url = "https://iserver.supermap.io/iserver/services/map-jingjin/rest/maps/京津地区土地利用现状图"; setLayer(); function setLayer() { //子图层属性过滤条件 var layerStatus = new SuperMap.LayerStatus({ layerName: "Landuse_R@Jingjin#1",//图层名称 isVisible: true,//是否可见 displayFilter: "LANDTYPE='灌丛' "//属性过滤条件 }); var setLayerStatusParameters = new SuperMap.SetLayerStatusParameters({ layerStatusList: [layerStatus]//数组来自上面的layerStatus //holdTime:15,//获取或设置资源在服务端保存的时间。 //resourceID:"2"//获取或设置资源服务 ID。 }); var setLayerStatusService = new SuperMap.SetLayerStatusService(url, { eventListeners: { "processCompleted": setLayerCompleted, "processFailed": setLayerFailed } }); setLayerStatusService.processAsync(setLayerStatusParameters); //console.log(setLayerStatusParameters) } function setLayerFailed(e) { console.log(e); } function setLayerCompleted(e) { console.log(e); tempLayerID = e.result.newResourceID; //创建地图控件 map = new ol.Map({ target: 'map', controls: ol.control.defaults({attributionOptions: {collapsed: false}}) .extend([new ol.supermap.control.Logo()]), view: new ol.View({ center:[116.85, 39.79], zoom: 7, projection: 'EPSG:4326', multiWorld: true }) }); layer = new ol.layer.Tile({ source: new ol.source.TileSuperMapRest({ url: url, transparent: true, cacheEnabled: false, redirect: true, wrapX: true, layersID: tempLayerID }), projection: 'EPSG:4326' }); map.addLayer(layer); } </script> </body> </html>