Thanks Matt for your help, it has been really helpful:<div>I post my solution:</div><div><br><div><div><i>var sites = new OpenLayers.Layer.Vector(&#39;Sites&#39;,{</i></div><div><span class="Apple-tab-span" style="white-space:pre"><i>                                </i></span><i>styleMap: styleMap,</i></div>

<div><span class="Apple-tab-span" style="white-space:pre"><i>                                </i></span><i>strategies: [</i></div><div><span class="Apple-tab-span" style="white-space:pre"><i>                                        </i></span><i>new OpenLayers.Strategy.Filter({</i></div>

<div><span class="Apple-tab-span" style="white-space:pre"><i>                                                </i></span><i>filter: new OpenLayers.Filter.Comparison({type: OpenLayers.Filter.Comparison.EQUAL_TO,property: &#39;approved&#39;,value: &quot;true&quot;})</i></div>

<div><span class="Apple-tab-span" style="white-space:pre"><i>                                        </i></span><i>}),</i></div><div><span class="Apple-tab-span" style="white-space:pre"><i>                                        </i></span><i>new OpenLayers.Strategy.BBOX({ratio: 1, resFactor: 1})</i></div>

<div><span class="Apple-tab-span" style="white-space:pre"><i>                                </i></span><i>], </i></div><div><span class="Apple-tab-span" style="white-space:pre"><i>                                </i></span><i>projection: new OpenLayers.Projection(&quot;EPSG:4326&quot;), </i></div>

<div><span class="Apple-tab-span" style="white-space:pre"><i>                                </i></span><i>protocol: new OpenLayers.Protocol.WFS({ </i></div><div><span class="Apple-tab-span" style="white-space:pre"><i>                                        </i></span><i>version: &quot;1.1.0&quot;, </i></div>

<div><span class="Apple-tab-span" style="white-space:pre"><i>                                </i></span><i>        srsName: &quot;EPSG:4326&quot;,</i></div><div><span class="Apple-tab-span" style="white-space:pre"><i>                                        </i></span><i>url: &#39;/geoserver/wfs/&#39;,</i></div>

<div><span class="Apple-tab-span" style="white-space:pre"><i>                                        </i></span><i>featureType: &#39;fs&#39;,</i></div><div><span class="Apple-tab-span" style="white-space:pre"><i>                                </i></span><i>        featurePrefix: &quot;prefix&quot;,</i></div>

<div><span class="Apple-tab-span" style="white-space:pre"><i>                                        </i></span><i>geometryName: &#39;point&#39;,</i></div><div><span class="Apple-tab-span" style="white-space:pre"><i>                                        </i></span><i>maxFeatures: &quot;100&quot;</i></div>

<div><span class="Apple-tab-span" style="white-space:pre"><i>                                </i></span><i>})</i></div><div><span class="Apple-tab-span" style="white-space:pre"><i>                        </i></span><i>});</i></div></div><div><br></div><div>the category filter is set dynamically when the user chooses one:</div>

<div><br></div><div><div><i><div>new Ext.form.ComboBox({</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>id: &#39;category&#39;,</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>store: new Ext.data.ArrayStore({</div>

<div><span class="Apple-tab-span" style="white-space:pre">                                                </span>fields: [&#39;id&#39;,&#39;category&#39;],</div><div><span class="Apple-tab-span" style="white-space:pre">                                                </span>data: sitesCategories</div><div>

<span class="Apple-tab-span" style="white-space:pre">                                        </span>}),</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>valueField: &#39;id&#39;,</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>displayField: &#39;category&#39;,</div>

<div><span class="Apple-tab-span" style="white-space:pre">                                        </span>mode: &#39;local&#39;,</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>typeAhead: true,</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>forceSelection: true,</div>

<div><span class="Apple-tab-span" style="white-space:pre">                                        </span>emptyText: &#39;Select a Category...&#39;,</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>triggerAction: &#39;all&#39;,</div>

<div><span class="Apple-tab-span" style="white-space:pre">                                        </span>editable: false,</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>width: 200,</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>listeners: {</div>

<div><span class="Apple-tab-span" style="white-space:pre">                                                </span>select: function(){</div><div><span class="Apple-tab-span" style="white-space:pre">                                                        </span></div><div><span class="Apple-tab-span" style="white-space:pre">                                                        </span>if(this.value !== &#39;ALL&#39;){</div>

<div><span class="Apple-tab-span" style="white-space:pre">                                                                </span>sites.filter = new OpenLayers.Filter.Comparison({type: OpenLayers.Filter.Comparison.EQUAL_TO,property: &#39;category&#39;,value: this.value});</div>

<div><span class="Apple-tab-span" style="white-space:pre">                                                        </span>}else{sites.filter = null;}</div><div><span class="Apple-tab-span" style="white-space:pre">                                                        </span>sites.redraw();</div><div><span class="Apple-tab-span" style="white-space:pre">                                                </span>}</div>

<div><span class="Apple-tab-span" style="white-space:pre">                                        </span>}//end listeners</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>})// end combo box</div></i></div><div><br></div><div>in that way each time the user pans, zooms or selects a category the layer is redrawed and are always keps at most 100 features.</div>

<div><br></div><div>Thanks a lot.</div><div><br></div><div class="gmail_quote">2010/11/23 Matt Priour <span dir="ltr">&lt;<a href="mailto:mpriour@kestrelcomputer.com">mpriour@kestrelcomputer.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

In memory spatial filtering is a computationally expensive process. IE (&lt;9) has a significantly!!! slower js engine than other browsers, so doing the filtering in this way is very slow on IE.<br>
The better way to accomplish what you are trying to do is to use a WFS or other &quot;feature server&quot; and do the filtering on the server side.<br>
To use a WFS you would do something like this:<br>
<br>
var catFilter = new OpenLayers.Filter({...});<br>
<br>
var wfsVector = new OpenLayers.Layer.Vector(&#39;my wfs layer&#39;,{<br>
  protocol:new OpenLayers.Protocol.WFS({ ... }),<br>
  strategies:[new OpenLayers.Strategy.BBOX()],<br>
  style:new OpenLayers.Style({rules:[catFilter]})<br>
});<br>
<br>
When the user zooms or pans, the WFS will be called and you will get the features in the view extent.<br>
When the user chooses a category to filter the features by, you write the correct value to the catFilter and then call wfsVector.redraw()<br>
<br>
OpenLayers.Vector.redraw() - will just redraw the existing features and re-evaluate the styles &amp; filters. It will not request features from the WFS.<br>
<br>
Matt Priour<br>
Kestrel Computer Consutling<br>
<br>
<br>
<br>
From: Simone Dalmasso<br>
Sent: Tuesday, November 23, 2010 4:21 AM<br>
To: <a href="mailto:users@geoext.org" target="_blank">users@geoext.org</a><br>
Subject: [Users] internet explorer extremely slow with spatial filter<div><div></div><div class="h5"><br>
<br>
<br>
Hi, I need to have my map to show features if they are in the current extent and if they match a selected category.<br>
So I&#39;ve written a filter function that uses the filterBy of the FeatureStore:<br>
<br>
<br>
function sitesFilter(){<br>
var extent = map.getExtent();<br>
featureStore.filterBy(function(record){<br>
var currentCategory = Ext.getCmp(&#39;category&#39;).value;<br>
var feature = record.data.feature;<br>
if(feature.data.category == currentCategory){<br>
return extent.containsLonLat(new OpenLayers.LonLat(feature.geometry.x,feature.geometry.y));<br>
}else if(!currentCategory || currentCategory == &#39;ALL&#39;){<br>
return extent.containsLonLat(new OpenLayers.LonLat(feature.geometry.x,feature.geometry.y));<br>
}<br>
});<br>
<br>
<br>
this is called on zoomend, moveend or when a category is chosen.<br>
All works pretty well and quick with each browser except for ie which is extremely slow and unusable.<br>
<br>
<br>
Is there something I can do to speed it up?<br>
<br>
<br>
Thanks in advance<br>
-- <br>
Simone<br>
<br>
<br>
<br>
<br></div></div>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@geoext.org" target="_blank">Users@geoext.org</a><br>
<a href="http://www.geoext.org/cgi-bin/mailman/listinfo/users" target="_blank">http://www.geoext.org/cgi-bin/mailman/listinfo/users</a> <br>
</blockquote></div><br><br clear="all"><br>-- <br>Simone Dalmasso, Ing.<br>ITHACA<br>Information Technology for Humanitarian Assistance, Cooperation and Action<br><a href="http://www.ithacaweb.org">www.ithacaweb.org</a><br>

Via Pier Carlo Boggio 61 - 10138 Torino<br>Tel: +39.011.1975.1854<br>
</div></div>