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"]});
相關文章
相關標籤/搜索