[OpenLayers-Users] Cluster strategy different styles
Arnaud Vandecasteele
arnaud.sig at gmail.com
Mon Jul 19 07:15:35 EDT 2010
Hello all,
In my application I use a cluster strategy to aggregate my data.
I would like to know if it's possible to use a specific style for :
* the data they are not clustered
* the data they are clustered
For example, here is the code I use actually :
var vesselStyle = new OpenLayers.Style({
'externalGraphic': '${iconURL}',
'graphicHeight' : 24,
'graphicWidth' : 24,
'pointRadius' : "${radius}"
},{
context: {
'radius' : function(feature){
console.log(vesselStyle);
if (feature.attributes.count>1){
return Math.min(feature.attributes.count,7) + 4;
}
},
'iconURL' : function(feature){
if (feature.attributes.count==1){
var type = feature.cluster[0].attributes.type;
var angle = feature.cluster[0].attributes.angle;
if(angle>=360){angle=0};
var angle5 = (Math.floor(angle / 5)) * 5;
if(feature.attributes.lengthVessel>80){size =
'l'}else{size = 's'}
return
iconURL+shipcolor[type]+'1_'+size+'_'+angle5+'.png';
}else{
return
}
}// EOF iconURL
}// EOF context
});// EOF vesselStyle
As you can see, I use a png for the feature that are not aggregated.
And I would like to draw a circle when the feature's count are more than one.
Do you think it's possible to mix two styles at the same time ?
Regards
Arnaud
More information about the Users
mailing list