I'm clustering the features on the layer using AnimatedCluster this way:
dataLayer = new OpenLayers.Layer.Vector("Data", {
strategies: [
new OpenLayers.Strategy.AnimatedCluster({
distance: 45,
animationMethod: OpenLayers.Easing.Expo.easeOut,
animationDuration: 60
})
],
styleMap: new OpenLayers.StyleMap(style)
});
Then I'm adding features to this layer:
var feature = new OpenLayers.Feature.Vector(
returnPoint(value.lng,value.lat),
{ description: "Description...."},
);
feature.attributes = {"myId":"weather"};
...
It works all right, but I'd like to change the image when the feature is not clustered (so it is visible as one), depending on the myId
attribute. I've created a filter (according to this example):
var filterLowestZoom = new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.EQUAL_TO,
property: "count",
value: 1
});
var filterWeather = new OpenLayers.Filter.Logical({filters: [filterLowestZoom,
new OpenLayers.Filter.Comparison({
type: "==",
property: "myId",
value: "weather"
})], type: OpenLayers.Filter.Logical.AND});
created the rule with this filter
var weatherRule = new OpenLayers.Rule({
filter: filterWeather,
symbolizer: {
externalGraphic: "weather.png",
graphicHeight: 22,
graphicWidth: 22,
fillOpacity:1.0
}
});
and then added the filter to map. It works when there's just filterLowestZoom set, but with the comparison to myId
attribute id shows nothing. What's wrong?