首页 / 浏览问题 / WebGIS / 问题详情
根据sql在iserver查询到数据集,怎么让查到的数据集不显示而不是删除
3EXP 2024年07月24日
根据sql在iserver查询到数据集,怎么让查到的数据集不显示而不是删除

1个回答

您好,您说的不显示,是只想要查询返回属性信息,不包括几何信息吗?iServer查询可以只返回属性信息,例如:

var param = new L.supermap.QueryBySQLParameters({
    queryParams: {
        name: "Capitals@World.1",
        attributeFilter: "SMID < 10"
    },
    queryOption: "ATTRIBUTE"
});
1,006EXP 2024年07月25日
let idsParam = new GetFeaturesBySQLParameters({
                datasetNames: datasetNames, //查询的数据源:数据集(固定,无需修改)
                // spatialQueryMode: "WITHIN",//查询条件
                // IDs: [200, 199]
                queryParameter: {
                    // attributeFilter: "ID in (420222000175,420222000227)"
                    attributeFilter: "ID in (420222000175)"
                },
                maxFeatures: 1000,
            })
            var features = new FeatureService(dataUrl).getFeaturesBySQL(idsParam, (serviceResult) => {
                let vectorSource = new VectorSource({
                    features: (new GeoJSON()).readFeatures(serviceResult.result.features),
                    wrapX: true,
                });
                
                let features = vectorSource.getFeatures();
                features.map(item=>{
                    // vectorSource.removeFeature(item);
                    item.setStyle(new Style({
                        stroke: new Stroke({
                            color: "rgba(255, 255, 255, 1)",
                            width: 20
                        }),
                        fill: new Fill({ //矢量图层填充颜色,以及透明度
                            color: 'rgba(255, 255, 255, 0.1)'
                        }),
                    }))
                })
                console.log(vectorSource,"vectorSource")
                that.layers = new VectorLayer({
                    source: vectorSource,
                    zIndex: 20,
                    id: 'areaDatas',
                    visible: true,
                });
                that.map.addLayer(that.layers);    查询后并返回数据集    想在发布的图层上让返回的数据集不显示怎么操作
您注释掉这一行,它就不会将查询出来的矢量数据显示到地图上了:

that.map.addLayer(that.layers);
查询出来不加怎么更新发布的服务图层,让发布的服务图层不展示查询到数据这段影像

您的这个需求可以通过请求临时图层的方式,将不展示的数据过滤掉,临时图层的使用方式可以参考:

https://ask.supermap.com/108518?show=108518#q108518

http://support.supermap.com.cn/DataWarehouse/WebDocHelp/iServer/mergedProjects/SuperMapiServerRESTAPI/root/maps/map/tempLayersSet/tempLayersSet.htm

...