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
  • 相关阅读:
    Java 线程
    杂记
    字符流分类详细介绍和各种字符流类介绍与使用 字符集
    内部类 与 匿名内部类
    Java IO流学习总结
    java的集合框架
    jquery 只能投票一次
    C# 简易版的计算器程序
    常用DBHelper类
    jQuery异步提交
  • 原文地址:https://www.cnblogs.com/sjfsjf/p/9232084.html
Copyright © 2011-2022 走看看