//页面初始加载图层
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左右条数据。有什么地方能优化下吗