首页 / 浏览问题 / 云GIS / 问题详情
Vector区域选中
23EXP 2018年08月08日
//页面初始加载图层
    function get_house() {
        //图层名称格式:数据集名称@数据源别名
        //FilterParameter 必设 name(查询地图图层名),attributeFilter(SQL条件语句)也为必设
        queryParam = new SuperMap.REST.FilterParameter({ name: "房屋_新街口@XC_ZW_ZT", attributeFilter: "" });
        //QueryBySQLParameters 参数必设queryParams
        queryBySQLParams = new SuperMap.REST.QueryBySQLParameters({ queryParams: [queryParam] });

        queryBySQLService = new SuperMap.REST.QueryBySQLService(xjk_house_url, {
            eventListeners: { "processCompleted": processCompleted_house, "processFailed": processFailed_house }
        });
        queryBySQLService.processAsync(queryBySQLParams);
    }

    function processCompleted_house(queryEventArgs) {
        var i, j, result = queryEventArgs.result;

        if (result && result.recordsets) {
            for (i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {

                if (recordsets[i].features) {
                    for (j = 0; j < recordsets[i].features.length; j++) {

                        var feature = recordsets[i].features[j];
                        var point = feature.geometry;
                        feature.style = styleno;
                        vector.addFeatures(feature);

                        //给vectorLayer添加单击事件             
                        selectFeature = new SuperMap.Control.SelectFeature(vector,
                                {
                                    onSelect: OnFeatureSelect,
                                    onUnselect: OnFeatureUnselect
                                });
                        selectFeature.repeat = true;
                        selectFeature.toggle = true;
                        map.addControl(selectFeature);
                        selectFeature.activate();

                    }
                }
            }
        }
    }

加载这个图层需要15秒左右,一共有3600左右条数据。有什么地方能优化下吗

1个回答

您好,如果想提高加载速度可以将原始数据进行优化,用桌面程序对数据进行空间索引、数据索引等操作,可以参考桌面软件帮助文档中性能优化这个主题进行尝试。

除此之外如果是使用8C版本的话可以考虑使用9D产品,9D的性能会更好一些。
5,668EXP 2018年08月09日
你好,先从我这个写法上考虑,有什么优化的思路吗
您好,这个在客户端上是没有办法进行优化了,只能通过桌面端进行优化
...