openlayers中多条件查询
function searchKeyword() {
var serchtxt = "于家堡高铁站";
var searchfield = evconfig.monitorconfig.searchfiled;
var sel = new OpenLayers.Filter.Comparison({ //比较操作符
type: OpenLayers.Filter.Comparison.LIKE,
property: searchfield,
value: "%" + serchtxt + "%"
});
var sel2 = new OpenLayers.Filter.Comparison({
type : OpenLayers.Filter.Comparison.EQUAL_TO,
property : "LC",
value : "F1"
});
var filter = new OpenLayers.Filter.Logical({
type: OpenLayers.Filter.Logical.AND,
filters: [sel,sel2]
});
createWFSsearch(filter);
}
//重点位置查询
function createWFSsearch(filter) {
var protocol = new OpenLayers.Protocol.WFS.v1_1_0({
version: "1.1.0",
url: evconfig.monitorconfig.layerurl,
featureType: evconfig.monitorconfig.layerrealname,
featureNS: evconfig.monitorconfig.webservicesNS,
geometryName: evconfig.monitorconfig.layershapeField,
featurePrefix: evconfig.monitorconfig.webservicesPrefix
});
protocol.read({
readOptions: {
output: "object"
},
maxFeatures: 1000,
filter: filter,
callback: function(resp) {
var features = resp.features;
var currentfeature = null;
for (var i = 0; i < features.length; i++) {
alert(features[i].attributes.NAME);
}
}
});
}
转载自:https://blog.csdn.net/wt346326775/article/details/53672444