[OpenLayers-Users] Cluster strategy not working

Shawn Oatley shawn at niagarafalls.ca
Fri Aug 28 09:26:45 EDT 2009


I don't have any input regarding the code, but I have worked with IE 8. 
Not sure if that is an option, but if it is, they have a powerful script
debugger that allows you to step through the code also.

Shawn

>>> Max Stephan <x.zam at gmx.net> 08/28/09 8:24 AM >>>

Hi Jerome,

I´d be very happy if I could use Firebug in this case (very nice tool
for
debugging and for tracking the DOM in my opinion) but as I mentioned
above:
I´m using an ActiveX-Control for reading out the Access-Database and for
sending further requests to it. And this method is only possible in
Internet
Explorer for which I haven´t found such a powerful debugging tool as
firebug
(firebug lite wasn´t useful).

Ok, now here´s the loop, which is adding the vector-features to my
vector-layer:
for (var i=0; i<mestArray.length; i++){
    addVector(vectorLayer, mestArray[i][1], mestArray[i][0]);
}
The first parameter is the target-layer, the second is a lonlat-object
and
the third is an attribute for the features.

And here´s the addVector-function:
function addVector(layer, lonlat, mestId){
   var geometryObjekt = new
OpenLayers.Geometry.Point(lonlat.lon,lonlat.lat);
   var vectorObjekt = new OpenLayers.Feature.Vector(geometryObjekt);
   vectorObjekt.attributes.mest = mestId;
   layer.addFeatures([vectorObjekt]);
}

And concerning your english: No need to be worried. I´m understanding
everything.

Thx in advance
Max Stephan

Jerome Freyre wrote:
> 
> Can you also show us your method that parse and add the feature to the
 
> layer?
> 
> I think another good way to explore is to use firefox and firebug.
> 
> With firebug, you can add breakpoints and the go step-by-step...
> 
> 
> Whith that, you should put a breakpoint into your method that parse  
> and add features to layer and another one into the cluster strategy  
> (Think to not use the OpenLayers minimised but the complete source) to
 
> see if software run into the class correctly...
> 
> 
> Hope my english is quite understandable.... :)
> 
> 
> 
> Jérome
> 
> 
> 
> Le 28 août 09 à 14:01, Max Stephan (via Nabble) a écrit :
> 
>> Hi Jerome,
>>
>> thanks for your reply. I already tried that but it causes an error  
>> ("this.layer.events" is null or no object) and the map content isn 
>> ´t shown.
>>
>> Any other ideas?
>>
>> Greets,
>> Max Stephan
>> Jerome Freyre wrote:
>> Hi Max,
>>
>> Personnally, when I use Cluster Strategy, I create separatly the  
>> strategy and the I activate it.
>>
>> 		
>> 			var strat = new
OpenLayers.Strategy.Cluster({distance:20});
>> 			vectorLayer = new
OpenLayers.Layer.Vector("Vektorlayer",{
>> 			strategies: [
>> 				strategy
>> 			],
>> 			styleMap: vectorStyle2, maxResolution: 19});
>> 			strat.activate();
>>
>>
>> Hope it will be usefull....
>>
>> Sincerly,
>> Jérome
>>
>> Max Stephan wrote:
>> Hi everybody,
>>
>> I`m having problems getting the cluster strategy to work. It simply  
>> makes no difference in terms of appearance if I add it to the  
>> VectorLayer or not.
>>
>> This is my code for the layer:
>> 		vectorLayer = new
OpenLayers.Layer.Vector("Vektorlayer",{
>> 			strategies: [
>> 				new
OpenLayers.Strategy.Cluster({distance:20})
>> 			],
>> 			styleMap: vectorStyle2, maxResolution: 19});
>>
>>
>> The reason why I want to add it is that I have 480 Features  
>> alltogether on my map and even when zooming into some areas there  
>> are still around 150 features left in the bbox causing  
>> InternetExplorer to slow down (don´t know if it´s the same case  
>> with Firefox, but I gotta use IE to use ADODB-Connection to an  
>> Access Database in the Intranet).
>>
>> Those features are created and added step by step with an addVector- 
>> method I have implemented that reads out the coordinates and  
>> attributes of the database for a single feature and then jumps to  
>> the next entry and repeats the procedure till all features have been 

>> added.
>>
>> greets and thx in advance
>> Max Stephan
>>
>>
>> View message @
>>
http://n2.nabble.com/Cluster-strategy-not-working-tp3533851p3534202.html
>> To unsubscribe from Re: Cluster strategy not working, click here.
>>
> 
> 
> 

-- 
View this message in context:
http://n2.nabble.com/Cluster-strategy-not-working-tp3533851p3534315.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list