[OpenLayers-Users] Anyone know how to do this with cluster strategy?

christopher.schmidt at nokia.com christopher.schmidt at nokia.com
Tue Jul 19 12:38:23 EDT 2011


I did that for 

  http://crschmidt.net/flickr/geo/tokyo

StyleMap used context to get the information for pointRadius;

        styleMap: new OpenLayers.StyleMap({'default': new OpenLayers.Style({ fillColor: 'red','pointRadius':'${radius}', 'externalGraphic': '${g}'  },
                {
                    context: {
                        g: function(feature) {
                            if (!feature.cluster) { 
                                return feature.attributes.image;
                            } else {
                                return "";
                            }
                        }, 
                        radius: function(feature) {
                            return feature.cluster ?
                                Math.min((Math.max(feature.cluster.length, 7) + 5)/2, 15) :
                                15;
                        }
                    }
                }),
                'select': {fillColor: 'blue', pointRadius: 20}
        }) 


and then clicking used the feature.cluster property to get the photos to display
on the right hand side.
  
On Jul 19, 2011, at 11:15 AM, ext Robert Buckley wrote:

> 
> http://www.os2020.org.nz/project-map/
> 
> Hi,
> 
> I would love to know how I could use the cluster strategy and display a point with the size based on  number of features, and also get a list of features in a popup to zoom to!
> 
> Anyone know....unfortunately the code doesn´t tell me much.
> 
> yours,
> 
> Rob
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users



More information about the Users mailing list