[OpenLayers-Users] cluster strategy problem

Donald Kerr donald.kerr at dkerr.co.uk
Tue Nov 5 07:34:17 PST 2013


Giuseppe,

"treshold" should be "threshold". I also have "distance: 50"

Regards,

Donald




From: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] On Behalf Of Giuseppe
Falcone
Sent: 05 November 2013 15:26
To: openlayers-users at lists.osgeo.org
Subject: [OpenLayers-Users] cluster strategy problem

Hi all,

I have a problem with a WFS Vector layer that return data in geoJSON format.
I have implemented this strategies:

"strategies": [
          new OpenLayers.Strategy.BBOX(),
          new OpenLayers.Strategy.Cluster({treshold:3})
 ]

this is my layer style configuration:
"styleMap": new OpenLayers.StyleMap({
     "default": new OpenLayers.Style({
           externalGraphic: "core/stub/simpleIcon.png",
                 label: "${label}",
                 cursor: "pointer"
           },
           {
               context:{
                   externalGraphic: function(feature) {
                        if (feature.cluster)
                              feature.attributes.externalGraphic =
"core/stub/clusterIcon.png";
                        return feature.attributes.externalGraphic;
                   },
                   label: function(feature) {
                         return feature.cluster ? feature.cluster.length :
"";
                    }
                }
              })
 })

Well, the features returned have always cluster attribute, also if the
feature is isolated there is a cluster array that contains a single feature.
In this manner I see always cluster icons, also on single feature. Anyone
has some ideas?
Thanks a lot.
Giuseppe




More information about the Users mailing list