OpenLayers, nice marker clustering

前端 未结 6 1202
刺人心
刺人心 2020-12-12 18:50

Do you know how to have a nice clustering in OpenLayers such as this google example ?

6条回答
  •  旧时难觅i
    2020-12-12 19:01

    you can do this with as igorti has said. the soltion is using OpenLayers.Strategy.Cluster class and styling your layer with OpenLayers.Style class...

    for styling :

    var pointStyle = new OpenLayers.Style({
    'default': new OpenLayers.Style({
    'pointRadius': '${radius}',
    'externalGraphic': '${getgraph}'
    ....
    },{
    context:{
    radius: function(feature){
        return Math.min(feature.attributes.count,7)+3;
    },{
    getgraph : function(feature){
        return 'ol/img/googlelike.png';
    }}}};
    

    it must helps you, more power to you!

提交回复
热议问题