Do you know how to have a nice clustering in OpenLayers such as this google example ?
You can add label to pointStyle in above example and explain context of this label. Your code should be something like this:
var pointStyle = new OpenLayers.Style({ // ... 'label': "${label}", // ... }, { context: { // ... label: function(feature) { // clustered features count or blank if feature is not a cluster return feature.cluster ? feature.cluster.length : ""; } // .. } }); var styleMap = new OpenLayers.StyleMap({ 'default': pointStyle, }); var googleLikeLayer = new OpenLayers.Layer.Vector("GoogleLikeLayer", { // ... styleMap : styleMap, // ... });
Use OpenLayers.Strategy.Cluster
for clustering.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With