<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7655.4">
<TITLE>RE: [OpenLayers-Users] Cluster strategy not working</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>i believe you need to add all your features at once,<BR>
so instead of looping the layer.addFeatures() call<BR>
you need to build all your features into an array and then call layer.addFeatures() once.<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: users-bounces@openlayers.org on behalf of Shawn Oatley<BR>
Sent: Fri 8/28/2009 9:26 AM<BR>
To: x.zam@gmx.net; users@openlayers.org<BR>
Subject: Re: [OpenLayers-Users] Cluster strategy not working<BR>
<BR>
I don't have any input regarding the code, but I have worked with IE 8.<BR>
Not sure if that is an option, but if it is, they have a powerful script<BR>
debugger that allows you to step through the code also.<BR>
<BR>
Shawn<BR>
<BR>
&gt;&gt;&gt; Max Stephan &lt;x.zam@gmx.net&gt; 08/28/09 8:24 AM &gt;&gt;&gt;<BR>
<BR>
Hi Jerome,<BR>
<BR>
I´d be very happy if I could use Firebug in this case (very nice tool<BR>
for<BR>
debugging and for tracking the DOM in my opinion) but as I mentioned<BR>
above:<BR>
I´m using an ActiveX-Control for reading out the Access-Database and for<BR>
sending further requests to it. And this method is only possible in<BR>
Internet<BR>
Explorer for which I haven´t found such a powerful debugging tool as<BR>
firebug<BR>
(firebug lite wasn´t useful).<BR>
<BR>
Ok, now here´s the loop, which is adding the vector-features to my<BR>
vector-layer:<BR>
for (var i=0; i&lt;mestArray.length; i++){<BR>
&nbsp;&nbsp;&nbsp; addVector(vectorLayer, mestArray[i][1], mestArray[i][0]);<BR>
}<BR>
The first parameter is the target-layer, the second is a lonlat-object<BR>
and<BR>
the third is an attribute for the features.<BR>
<BR>
And here´s the addVector-function:<BR>
function addVector(layer, lonlat, mestId){<BR>
&nbsp;&nbsp; var geometryObjekt = new<BR>
OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat);<BR>
&nbsp;&nbsp; var vectorObjekt = new OpenLayers.Feature.Vector(geometryObjekt);<BR>
&nbsp;&nbsp; vectorObjekt.attributes.mest = mestId;<BR>
&nbsp;&nbsp; layer.addFeatures([vectorObjekt]);<BR>
}<BR>
<BR>
And concerning your english: No need to be worried. I´m understanding<BR>
everything.<BR>
<BR>
Thx in advance<BR>
Max Stephan<BR>
<BR>
Jerome Freyre wrote:<BR>
&gt;<BR>
&gt; Can you also show us your method that parse and add the feature to the<BR>
<BR>
&gt; layer?<BR>
&gt;<BR>
&gt; I think another good way to explore is to use firefox and firebug.<BR>
&gt;<BR>
&gt; With firebug, you can add breakpoints and the go step-by-step...<BR>
&gt;<BR>
&gt;<BR>
&gt; Whith that, you should put a breakpoint into your method that parse&nbsp;<BR>
&gt; and add features to layer and another one into the cluster strategy&nbsp;<BR>
&gt; (Think to not use the OpenLayers minimised but the complete source) to<BR>
<BR>
&gt; see if software run into the class correctly...<BR>
&gt;<BR>
&gt;<BR>
&gt; Hope my english is quite understandable.... :)<BR>
&gt;<BR>
&gt;<BR>
&gt;<BR>
&gt; Jérome<BR>
&gt;<BR>
&gt;<BR>
&gt;<BR>
&gt; Le 28 août 09 à 14:01, Max Stephan (via Nabble) a écrit :<BR>
&gt;<BR>
&gt;&gt; Hi Jerome,<BR>
&gt;&gt;<BR>
&gt;&gt; thanks for your reply. I already tried that but it causes an error&nbsp;<BR>
&gt;&gt; (&quot;this.layer.events&quot; is null or no object) and the map content isnÂ<BR>
&gt;&gt; ´t shown.<BR>
&gt;&gt;<BR>
&gt;&gt; Any other ideas?<BR>
&gt;&gt;<BR>
&gt;&gt; Greets,<BR>
&gt;&gt; Max Stephan<BR>
&gt;&gt; Jerome Freyre wrote:<BR>
&gt;&gt; Hi Max,<BR>
&gt;&gt;<BR>
&gt;&gt; Personnally, when I use Cluster Strategy, I create separatly the&nbsp;<BR>
&gt;&gt; strategy and the I activate it.<BR>
&gt;&gt;<BR>
&gt;&gt; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&gt;&gt; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var strat = new<BR>
OpenLayers.Strategy.Cluster({distance:20});<BR>
&gt;&gt; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vectorLayer = new<BR>
OpenLayers.Layer.Vector(&quot;Vektorlayer&quot;,{<BR>
&gt;&gt; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strategies: [<BR>
&gt;&gt; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strategy<BR>
&gt;&gt; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ],<BR>
&gt;&gt; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; styleMap: vectorStyle2, maxResolution: 19});<BR>
&gt;&gt; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strat.activate();<BR>
&gt;&gt;<BR>
&gt;&gt;<BR>
&gt;&gt; Hope it will be usefull....<BR>
&gt;&gt;<BR>
&gt;&gt; Sincerly,<BR>
&gt;&gt; Jérome<BR>
&gt;&gt;<BR>
&gt;&gt; Max Stephan wrote:<BR>
&gt;&gt; Hi everybody,<BR>
&gt;&gt;<BR>
&gt;&gt; I`m having problems getting the cluster strategy to work. It simply&nbsp;<BR>
&gt;&gt; makes no difference in terms of appearance if I add it to the&nbsp;<BR>
&gt;&gt; VectorLayer or not.<BR>
&gt;&gt;<BR>
&gt;&gt; This is my code for the layer:<BR>
&gt;&gt; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vectorLayer = new<BR>
OpenLayers.Layer.Vector(&quot;Vektorlayer&quot;,{<BR>
&gt;&gt; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strategies: [<BR>
&gt;&gt; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new<BR>
OpenLayers.Strategy.Cluster({distance:20})<BR>
&gt;&gt; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ],<BR>
&gt;&gt; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; styleMap: vectorStyle2, maxResolution: 19});<BR>
&gt;&gt;<BR>
&gt;&gt;<BR>
&gt;&gt; The reason why I want to add it is that I have 480 Features&nbsp;<BR>
&gt;&gt; alltogether on my map and even when zooming into some areas there&nbsp;<BR>
&gt;&gt; are still around 150 features left in the bbox causing&nbsp;<BR>
&gt;&gt; InternetExplorer to slow down (don´t know if it´s the same case&nbsp;<BR>
&gt;&gt; with Firefox, but I gotta use IE to use ADODB-Connection to an&nbsp;<BR>
&gt;&gt; Access Database in the Intranet).<BR>
&gt;&gt;<BR>
&gt;&gt; Those features are created and added step by step with an addVector-<BR>
&gt;&gt; method I have implemented that reads out the coordinates and&nbsp;<BR>
&gt;&gt; attributes of the database for a single feature and then jumps to&nbsp;<BR>
&gt;&gt; the next entry and repeats the procedure till all features have been<BR>
<BR>
&gt;&gt; added.<BR>
&gt;&gt;<BR>
&gt;&gt; greets and thx in advance<BR>
&gt;&gt; Max Stephan<BR>
&gt;&gt;<BR>
&gt;&gt;<BR>
&gt;&gt; View message @<BR>
&gt;&gt;<BR>
<A HREF="http://n2.nabble.com/Cluster-strategy-not-working-tp3533851p3534202.html">http://n2.nabble.com/Cluster-strategy-not-working-tp3533851p3534202.html</A><BR>
&gt;&gt; To unsubscribe from Re: Cluster strategy not working, click here.<BR>
&gt;&gt;<BR>
&gt;<BR>
&gt;<BR>
&gt;<BR>
<BR>
--<BR>
View this message in context:<BR>
<A HREF="http://n2.nabble.com/Cluster-strategy-not-working-tp3533851p3534315.html">http://n2.nabble.com/Cluster-strategy-not-working-tp3533851p3534315.html</A><BR>
Sent from the OpenLayers Users mailing list archive at Nabble.com.<BR>
_______________________________________________<BR>
Users mailing list<BR>
Users@openlayers.org<BR>
<A HREF="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</A><BR>
<BR>
_______________________________________________<BR>
Users mailing list<BR>
Users@openlayers.org<BR>
<A HREF="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</A><BR>
<BR>
<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>