Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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

share|improve this answer
    
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 Mar 10 '13 at 13:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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