[OpenLayers-Users] Polygon Cluster

Jerome Freyre jerome.freyre at hispeed.ch
Mon Oct 27 11:42:39 EDT 2008


It's normal because the cluster strategy replace your features with points.

The main goal for a cluster strategy is to regroup features that are close
and make the map the more "readable".

And with the cluster strategy you can change the radius of the clustered
points like that :

// Définit les styles des features
var style = new OpenLayers.Style({
        fillColor: "#ee9900",
        fillOpacity: 0.8, 
        hoverFillColor: "#ee9900",
        hoverFillOpacity: 0.8,
        strokeColor: "#ee9900",
        strokeOpacity: 0.8,
        strokeWidth: 1,
        strokeLinecap: "round",
        strokeDashstyle: "solid",
        hoverStrokeColor: "blue",
        hoverStrokeOpacity: 1,
        hoverStrokeWidth: 0.2,
        pointRadius: "${radius}",
        hoverPointRadius: 1,
        hoverPointUnit: "%",
        pointerEvents: "visiblePainted",
        cursor: "inherit"
    }, {
        context: {
            radius: function(feature) {
                    return Math.min(feature.attributes.count, 9) + 4;
            }
    });

    view = new OpenLayers.Layer.Vector("View", {
                //        strategies:  [fixedStrategy, clusterStrategy,
lineStringclusterStrategy],
						strategies:  [fixedStrategy, clusterStrategy],
                        protocol: myprotocol,
                        styleMap: new OpenLayers.StyleMap({
                            "default": style,
                            "select": {
                            fillColor: "#8aeeef",
                            strokeColor: "#32a8a9"
                        }
                    })
                }); 


Hope it will help you ;)


-- 
View this message in context: http://www.nabble.com/Polygon-Cluster-tp20189385p20190295.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list