Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I need to be able to select features on a wfs layer using a polygon instead of a box. I was hoping this would be a standard option in the SelectFeature class. Too bad this isn't the case.

Any implementation suggestions?

share|improve this question

1 Answer 1

You can use the layer.filter property on the vector layer then refresh the layer.

layer.filter = new OpenLayers.Filter.Spatial({
    type: OpenLayers.Filter.Spatial.INTERSECTS,
    value: event.feature.geometry
});
layer.refresh({force: true});

Here's the Example

Granted this will make all the non-selected layers disappear, but you can possibly do this just to collect the array of features (without refreshing the layer) then use the SelectFeature class to select only the ones the filter returned.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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