zoukankan      html  css  js  c++  java
  • openlayers 聚合效果

     //cyd
        var cydclusterSource = new ol.source.Cluster({
          distance: 40,
          source: new ol.source.Vector({
            features:(new ol.format.GeoJSON()).readFeatures(JSON.stringify(cyd))
          })
        });
         //sc
         var scclusterSource = new ol.source.Cluster({
          distance: 40,
          source: new ol.source.Vector({
            features:(new ol.format.GeoJSON()).readFeatures(JSON.stringify(sc))
          })
        });
         //sy
         var syclusterSource = new ol.source.Cluster({
          distance: 40,
          source: new ol.source.Vector({
            features:(new ol.format.GeoJSON()).readFeatures(JSON.stringify(sy))
          })
        });
         //xq
         var xqclusterSource = new ol.source.Cluster({
          distance: 40,
          source: new ol.source.Vector({
            features:(new ol.format.GeoJSON()).readFeatures(JSON.stringify(xq))
          })
        });
    
    
     var cydstyleCache = {};
         this.cydVectorLayer = new ol.layer.Vector({
          source:cydclusterSource,
          style:function(feature) {     
            var size = feature.get('features').length;            
            var style = cydstyleCache[size];
            if (!style) {
              style = new ol.style.Style({
                image: new ol.style.Circle({
                 radius: 20,
                 stroke: new ol.style.Stroke({
                  color: '#fff'
                }),
                 fill: new ol.style.Fill({
                  color: '#3399CC'
                })
               }),
                text: new ol.style.Text({
                  text: "cyd  "+size.toString(),
                  fill: new ol.style.Fill({
                    color: '#fff'
                  })
                })
              });
              cydstyleCache[size] = style;
            }
            return style;
          }
        });



    https://blog.csdn.net/zy13608089849/article/details/70809354
  • 相关阅读:
    LLDB 常用的调试命令
    iOS https认证
    pod lib lint xxx.podspec 验证出错 Could not find a `ios` simulator
    LLDB 调试
    First throw call stack: 不打印方法名
    AOP
    增强现实
    2017
    iOS的主要框架介绍 (转载)
    iOS中都有什么设计模式?各个设计模式的作用 (转载)
  • 原文地址:https://www.cnblogs.com/sjfsjf/p/9232084.html
Copyright © 2011-2022 走看看