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.<br><br>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.<br>
<br>Thanks again!<br>Matt<br><br><div class="gmail_quote">On Mon, Jun 1, 2009 at 4:17 PM, Eric Lemoine <span dir="ltr"><<a href="mailto:eric.lemoine@camptocamp.com">eric.lemoine@camptocamp.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">On Thursday, May 28, 2009, Matt Kenny <<a href="mailto:matthewkenny@gmail.com">matthewkenny@gmail.com</a>> wrote:<br>
> Hello,<br>
><br>
> I've got a quick question that I'm hoping someone knows the answer to.<br>
><br>
> I've got a single vector layer containing both point and line features.<br>
><br>
> All features have a 'TYPE' attribute. Points are either 'TYPE:COMPANY' or 'TYPE:AIRPORT', and lines are always 'TYPE:ROUTE'.<br>
><br>
> 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'?<br>
<br>
</div>Registering a beforefeaturesadded listener and have this listener<br>
filter out features that aren't of type TYPE:COMPANY should work. The<br>
listener would look like:<br>
<br>
function filter(evt) {<br>
var features = [];<br>
for(var i=0, len=evt.features.length; i<len; i++) {<br>
if(evt.features[i].attributes.type == "TYPE:COMPANY") {<br>
features.push(evt.features[i]);<br>
}<br>
}<br>
evt.features = features; // with that the cluster strategy will<br>
see a different set of features<br>
}<br>
<br>
The thing is you need to register the listener *before* the cluster<br>
strategy is activated. For that either (a) set autoActivate to false<br>
in the strategy config, and activate the strategy yourself after the<br>
registration of your beforefeaturesadded listener, (b) deactivate the<br>
strategy, register your listener, and activate the strategy again. (a)<br>
is more elegant I think.<br>
<br>
Cheers,<br>
<div class="im"><br>
<br>
<br>
<br>
><br>
> Thanks,<br>
> Matt<br>
> --<br>
> m a t t h e w k e n n y<br>
> <a href="http://www.mkgeomatics.com" target="_blank">http://www.mkgeomatics.com</a><br>
> Sent from Tempe, AZ, United States<br>
><br>
<br>
</div>--<br>
Eric Lemoine<br>
<br>
Camptocamp France SAS<br>
Savoie Technolac, BP 352<br>
73377 Le Bourget du Lac, Cedex<br>
<br>
Tel : 00 33 4 79 44 44 96<br>
Mail : <a href="mailto:eric.lemoine@camptocamp.com">eric.lemoine@camptocamp.com</a><br>
<a href="http://www.camptocamp.com" target="_blank">http://www.camptocamp.com</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>m a t t h e w k e n n y<br><a href="http://www.mkgeomatics.com">http://www.mkgeomatics.com</a><br>Sent from Santa Paula, CA, United States