首页 / 浏览问题 / WebGIS / 问题详情
iclient ol地图sql查询多个图层怎么处理features
23EXP 2020年12月18日
iclient ol地图sql查询多个图层怎么处理features能够显示到一个layer里面?目前代码如下:此代码显示不出来要素,但是单独引用features1是能显示出来的

function query() {
        var param = new SuperMap.QueryBySQLParameters({
            queryParams: [{name: "SS"},{name: "SS2"}]
        });
        new ol.supermap.QueryService(url).queryBySQL(param, function (serviceResult) {
            var features1=(new ol.format.GeoJSON()).readFeatures(serviceResult.result.recordsets[0].features);
             var features2=(new ol.format.GeoJSON()).readFeatures(serviceResult.result.recordsets[1].features);
             var fea=[features1,features2]
            var vectorSource = new ol.source.Vector({
                features: fea,
                wrapX: false
            });
            resultLayer = new ol.layer.Vector({
                source: vectorSource
            });
            map.addLayer(resultLayer);
        });
    }
...