Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var style = new OpenLayers.Style({ pointRadius: "${radius}", fillColor: "#ffcc66", fillOpacity: 0.8, strokeColor: "#cc6633", strokeWidth: 1, strokeOpacity: 0.8, label: "${getLabel}" }, {
- context: {
- getLabel: function(feature) {
- if (feature.cluster) {
- if (feature.cluster.length > 1) {
- return feature.cluster.length;
- }
- }
- return '';
- },
- radius: function(feature) {
- var pix = 2;
- if(feature.cluster) {
- pix = Math.min(feature.attributes.count, 7) + 3;
- }
- return pix;
- }
- }
- });
- strategy = new OpenLayers.Strategy.Cluster();
- featureSubVector = new OpenLayers.Layer.Vector("Clusters", {
- strategies: [strategy],
- styleMap: new OpenLayers.StyleMap({ "default": style, "select": { fillColor: "#8aeeef", strokeColor: "#32a8a9" } })
- });
- var selectControl = new OpenLayers.Control.SelectFeature( featureSubVector, {hover: true} );
- map.addControl(selectControl);
- selectControl.activate();
- map.addLayer(featureSubVector);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement