[GIS] openlayers cluster strategy – exhibiting custom icons for clusters of 1 feature

clusteringopenlayers-2

i have a page that displays a vector layer imported from a kml file (basically like the the sundials example). it works perfectly well, both using fixed strategy ONLY, as well as using both fixed and CLUSTER strategies simultaneously.

i would like to create a hybrid display, whereas "clusters of 1 feature" would be displayed with the original custom icon contained in the KML file under <Style><IconStyle><Icon><href>img/arrowRed.png, for example.

right now, if i use cluster strategy, clusters of 1 (feature) are displayed using the default icon (yellow disk).

i would rather not use any plugins or libraries that aren't standard openlayers. any suggestions?

below a part of the original javascript code using clusters (remove the cluster strategy declaration new OpenLayers.Strategy.Cluster() and custom icons are displayed just fine):

var urlKMLClient = 'KMLClientsAll.kml'; 
var layerKMLClient = new OpenLayers.Layer.Vector("Clients", {
        strategies: [new OpenLayers.Strategy.Fixed(), new OpenLayers.Strategy.Cluster(), refresh],
        protocol: new OpenLayers.Protocol.HTTP({
            url: urlKMLClient,
            format: new OpenLayers.Format.KML({
                extractStyles: true, 
                extractAttributes: true,
                maxDepth: 2
            })
        })
    }); 

WITHOUT CLUSTER

see Client custom icon (green marker) gives way to cluster default icon (yellow disk) below

WITH CLUSTER

Best Answer

Use: new OpenLayers.Strategy.Cluster({threshold:2}) this allows thad isolated points they are not in a cluster.