you can catch your opened(active) popup with this way:
map.popups[a]
you can change so update its content:
map.popups[a].contentHTML = 'Test Content';
map.popups[a].redraw();
or
map.popups[a].setContentHTML = 'Test Content'
you can show or hide your popup:
map.popups[a].show();
map.popups[a].hide();
you can update position of your popup:
map.popups[a].lonlat.lon = 10;
map.popups[a].lonlat.lat = 10;
map.popups[a].updatePosition();
for openlayers cluster you should check out Cluster Strategy Example here. Only one thing you should do is that define fillColor or externalGraphic for your cluster.
var style = new OpenLayers.Style({
pointRadius: "${radius}",
fillColor: "${getColor}",
fillOpacity: 0.8,
strokeColor: "#cc6633",
strokeWidth: 2,
strokeOpacity: 0.8
}, {
context: {
radius: function(feature) {
return Math.min(feature.attributes.count, 7) + 3;
},
getColor: function(feature) {
return // Your color selection logic;
}
}
});
As the last question, i dont understand very well what you want? but try to use removeFeatures instead of destroyFeatures....
i hope it helps you...
Best Answer
This example should show you exactly what you need.
https://openlayers.org/en/latest/examples/select-multiple-features.html