0

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

1 Answer 1

1

I think you need something like this:

'featureselected': function(panel, feature) {
                    for (var f = 0; f < features.length; f++) {
                        features[f], 'default';
                    }
                    feature, 'select';
                }

This is perhaps what you have in mind:

http://api.geoext.org/1.1/examples/feature-grid.html

the code is here:

http://api.geoext.org/1.1/examples/feature-grid.js

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.