Le Wednesday 22 October 2008 15:39:57 arno974, vous avez écrit :
> Ahh okay i understand what you want.
>
> With the OpenLayers.Strategy.Cluster you can only  merge the features when
> they are close to each other. In your example, the two points have been
> merge into only one.
>
> If you want to enlarge the radius size of the point you must change with
> the pointRadius parameter of your Style object :
>
> for example :
>
>  var style = new OpenLayers.Style({
>                          pointRadius: "${radius}",
>                          fillColor: "#ffcc66",
>                          fillOpacity: 0.8,
>                          strokeColor: "#ff0000",
>                          strokeWidth: 2,
>                          strokeOpacity: 0.3
>                      }, {
>                          context: {
>                              radius: function(feature) {
>                                     /*
> console.log(Math.min(feature.attributes.count,7) + 4);
>
> if((Math.min(feature.attributes.count,7) + 4)<7) {
>                                             return
> Math.min(feature.attributes.count,7) + 3;
>                                         }
>                                         else {return
> Math.min(feature.attributes.count,7) + 7;} */
>                                 return Math.min(feature.attributes.count,7)
> + 4;
>                              }
>                          }
>                      });
>
> GML = new OpenLayers.Layer.Vector(
>                         "GML", {
>                          strategies:[
>                                             new
> OpenLayers.Strategy.Fixed(), new
> OpenLayers.Strategy.Cluster()
>                               ],
>                          protocol: new OpenLayers.Protocol.HTTP({
>                              url: "./poi_random/gml/random_poi.gml",
>                              format: new OpenLayers.Format.GML()
>                          }),
>                             styleMap:new OpenLayers.StyleMap({
>                              "default": style,
>                              "select": {
>                                  fillColor: "#8aeeef",
>                                  strokeColor: "#32a8a9"
>                              }
>                          })
>                      });
>
>
>
> it merge the features when they are
>
> Yves Jacolin (free) wrote:
> > Le Wednesday 22 October 2008 12:33:04 arno974, vous avez écrit :
> >> Hello Yves,
> >>
> >> Tried to add a new OpenLayers.Strategy.Fixed(), in your strategies and
> >> it should work.
> >> I noticed that the cluster doesn't work if i don't use the fixed
> >> strategy.
> >> Maybe a bug or i didn't use it in a good way.
> >>
> >> Here you will find an example : http://geotribu.net/?q=node/47
> >>
> >> Regards
> >>
> >> Arnaud
> >>
> >> Yves Jacolin (free) wrote:
> >> > Hello,
> >> >
> >> > I am trying to set up a cluster strategy for one of my vector layer. I
> >> > add this code to my existing code:
> >> >   var vector = new OpenLayers.Layer.Vector(name,
> >> >                   {
> >> >                      strategies: [
> >> >                         new OpenLayers.Strategy.Cluster({distance:20})
> >> >                       ]
> >> >                   }
> >> >                 );
> >> > Before this, the code was " var vector = new
> >> > OpenLayers.Layer.Vector(name);"
> >> >
> >> > I fill my vectorLayers later, reading a postgis result with:
> >> >
> >> > var feature = wktParser.read(_tmp[1]);
> >> > [..]
> >> > vectorLayer.addFeatures([ feature ]);
> >> >
> >> > I get only one feature (instead of 2) for all the zoom level. I tried
> >>
> >> to
> >>
> >> > change the distance option above, but nothing append. If I check the
> >>
> >> DOM,
> >>
> >> > nothing show me that there are more than 1 feature in this layer.
> >> >
> >> > Where am I wrong?
> >> >
> >> > Y.
> >> > PS : the code is much more longer than here and is split in several
> >> > functions
> >> > so I can't show you all in once, I tried to put the most readable as
> >> > possible.
> >> > --
> >> > Yves Jacolin
> >
> > Hi,
> >
> > Thanks Arnaud, but it doesn't change anything for me, except that now I
> > have
> > to define a protocol parameter in my Vector constructor.
> >
> > Do I need to load data when creating the layer? Currently I load my data
> > later
> > in the process (at the end of the page) as I need to load different data
> > after the search process.
> >
> > Y.
> > --
> > Yves Jacolin
> > ---
> > http://softlibre.gloobe.org
> > _______________________________________________
> > Users mailing list
> > Users@openlayers.org
> > http://openlayers.org/mailman/listinfo/users

Hi,

Sorry, same problem: I think there is another problem somewhere. I have 4 
features, each time I see one of them. I should see at least 3 features, as 2 
are in the same street so have to be in one cluster.

The issue is that when I zoom on one feature (in "La defense", west of Paris), 
it disapears and after zooming out, another feature appear (in the south-east 
of Paris) in other location. Strange behaviour ;)

Y.
PS : http://softlibre.free.fr/ol/test.html updated!
-- 
Yves Jacolin
---
http://softlibre.gloobe.org
_______________________________________________
Users mailing list
Users@openlayers.org
http://openlayers.org/mailman/listinfo/users

Reply via email to