[OpenLayers-Users] cluster strategy problem

Giuseppe Falcone falcone.giuseppe at gmail.com
Tue Nov 5 07:26:06 PST 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20131105/89210904/attachment.html>


More information about the Users mailing list