openlayers之cluster——加载大数据…

<script
type=”text/javascript”>
       
var dx = 3;
       
var dy = 3;
       
var px, py;
       
var features = [];
       
var strategy, clusters;;
       
function draw() {
           
var ic = “Images/Icon/car_yellow_0.png”;
           
for (var i = 0; i < 400; i++) {
               
var sHtml = “<tr><td
valign=\”top\”>test</td><td
valign=\”top\”>” + i.toString() +
“</td></tr>”;

               
px = Math.random() * (122 – 121 + 0.001) + 121;
               
py = Math.random() * (30 – 29 + 0.001) + 29;
               
var ll = tranformTo900913(px, py); 
//将4326坐标转换为900913
               
features.push(new OpenLayers.Feature.Vector(
                       
new OpenLayers.Geometry.Point(ll.lon, ll.lat), { x: ll.lon, y:
ll.lat, html: sHtml, img: ic, name: “浙B” + i.toString() }
                   
));
           
}

 

           
var style = new OpenLayers.Style({
               
fontSize: “9pt”,
               
fontWeight: “bold”
           
}, {
               
rules: [
               
new OpenLayers.Rule({
                   
filter: new
OpenLayers.Filter.Comparison({     
//设置单点时的图标
                       
type:
OpenLayers.Filter.Comparison.EQUAL_TO,   

                       
property: “count”,  //获取合并点数
                       
value: 1
                   
}),
                   
symbolizer: {
                       
graphicWidth: 25,
             

转载自:https://blog.csdn.net/ZHANGHUI3239619/article/details/78746814

You may also like...