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


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


1 Answer 1


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

  • spot on. UPVOTED! thank you very much for taking the time to answer the question. this seems to be confirmation of what i had found to be a solution a couple of days ago. IF you are a stackOverflow member, please answer my question there and i will award you the solution also (i feel that awarding myself the correct answer is weird somehow): stackoverflow.com/q/15300467/1166727
    – tony gil
    Commented Mar 10, 2013 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.