openlayers wfs获取要素

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"]
});
posted @ 2015-06-18 00:25  谁说我不是会员  阅读(1102)  评论(0编辑  收藏  举报