var wfsProtocol = new OpenLayers.Protocol.WFS.v1_1_0({
url: mapServerUrl + "/wfs",
featureType: layerConfig.layerName,
featureNS: nameSpace,//正式环境代码:nameSpace
maxFeatures: 2000,
outputFormat: 'JSON',
callback: function (req) {
var features = req.features;
//根据attributeName代表的值的大小排序,从小到大排序
features = features.sort(
function (a, b) {
return a.attributes[attributeName] - b.attributes[attributeName];
}
);
queryResultCache[layerConfig.layerName] = features;
}
});
//propertyNames中可配置关心的属性名,而不是查询所有属性,这样能加快查询速度,其中the_geom查询的是空间数据,其他是属性数据
wfsProtocol.read({
propertyNames: ["ROADBM", "ROADPOS","the_geom"]
});
转载于:https://www.cnblogs.com/shuishuowobushihuiyuan/p/4584713.html