I need to get all features' names, and for that I did a listview to put all features' names on it.
So when I click one feature, not on the map but on the listview, the feature must be selected.
Here it is my code:
for(var f=0;f<select.features.length;f++) {
if(select.features[f].attributes.ADI == "TALAS") {
alert(select.features[0].attributes.ADI);
break;
}
}
When I click a feature on a map, the select.features.length will be 1.
But I don't need to select the feature on the map, I must have the array of features and then I search attributes on this array and select that feature. That's what I would like to get.
How do I get this working?
I try to write some codes about that:
select.removeAllFeatures();
filter = new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.EQUAL_TO,
property: "ADI",
value: "TALAS"
});
filterStrategy = new OpenLayers.Strategy.Filter({filter: filter});
groups = new OpenLayers.Control.GetFeature({
strategies: [new OpenLayers.Strategy.Fixed(),filterStrategy],
protocol: OpenLayers.Protocol.WFS.fromWMSLayer(ilce)
});
select.addFeatures(groups.feature);
I got this error message:
Uncaught TypeError: Cannot set property 'layer' of undefined