Thanks to both of you for the suggestions. It turned out that simply separating the TYPE:COMPANY features to their own layer, and applying a cluster strategy on it was the easiest solution.
I had originally put all features on the same vector layer so that they could all be selected at the same time. By upgrading to OpenLayers 2.8, i was able to separate the layers, while passing an array of all layers to my select feature control. Thanks again! Matt On Mon, Jun 1, 2009 at 4:17 PM, Eric Lemoine <[email protected]>wrote: > On Thursday, May 28, 2009, Matt Kenny <[email protected]> wrote: > > Hello, > > > > I've got a quick question that I'm hoping someone knows the answer to. > > > > I've got a single vector layer containing both point and line features. > > > > All features have a 'TYPE' attribute. Points are either 'TYPE:COMPANY' or > 'TYPE:AIRPORT', and lines are always 'TYPE:ROUTE'. > > > > I'm wondering if it is possible to create a cluster strategy that only > clusters features in my vector layer that are of an attribute, > 'TYPE:COMPANY'? > > Registering a beforefeaturesadded listener and have this listener > filter out features that aren't of type TYPE:COMPANY should work. The > listener would look like: > > function filter(evt) { > var features = []; > for(var i=0, len=evt.features.length; i<len; i++) { > if(evt.features[i].attributes.type == "TYPE:COMPANY") { > features.push(evt.features[i]); > } > } > evt.features = features; // with that the cluster strategy will > see a different set of features > } > > The thing is you need to register the listener *before* the cluster > strategy is activated. For that either (a) set autoActivate to false > in the strategy config, and activate the strategy yourself after the > registration of your beforefeaturesadded listener, (b) deactivate the > strategy, register your listener, and activate the strategy again. (a) > is more elegant I think. > > Cheers, > > > > > > > > Thanks, > > Matt > > -- > > m a t t h e w k e n n y > > http://www.mkgeomatics.com > > Sent from Tempe, AZ, United States > > > > -- > Eric Lemoine > > Camptocamp France SAS > Savoie Technolac, BP 352 > 73377 Le Bourget du Lac, Cedex > > Tel : 00 33 4 79 44 44 96 > Mail : [email protected] > http://www.camptocamp.com > -- m a t t h e w k e n n y http://www.mkgeomatics.com Sent from Santa Paula, CA, United States
_______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
