follow question:wfs-load-feature-check
the scenario is: i am trying to load a WFS layer, since it takes a while to load all features, I want to give user a notice while waiting for response. the process employs spatial filter (BBOX strategy) and attribute filters. I am wondering whether there is a good way to make WFS protocol work with these filters, in other words, only request the filtered features.
thanks a lot!
code sample:
var wfsLayer = new OpenLayers.Layer.Vector("WFS", {
strategies: [new OpenLayers.Strategy.BBOX()],
styleMap: new OpenLayers.StyleMap({
strokeWidth: 3,
strokeColor: "#333333"
})
});
var filt = new OpenLayers.Filter.Logical({
type: OpenLayers.Filter.Logical.OR,
filters: [
new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.EQUAL_TO,
property: "TYPE",
value: "highway"
}),
new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.EQUAL_TO,
property: "TYPE",
value: "road"
})
]
});
var prot = new OpenLayers.Protocol.WFS({
url: "http://demo.opengeo.org/geoserver/wfs",
featureType: "tasmania_roads",
featureNS: "http://www.openplans.org/topp"
});
var _CallBack = function(resp) {
if(resp.error) {
console.log('error');
return -1;
}
wfsLayer.addFeatures(resp.features);
console.log('success');
return 1;
};
var response = prot.read({
callback: _CallBack
});
