概述:
在前面的博文中讲述过基于Arcgis for js如何实现聚类统计展示,在本文中讲述如何基于openlayers实现聚类统计的效果,Arcgis for js聚类统计的博文地址为:
http://blog.csdn.net/gisshixisheng/article/details/40867989
效果:
实现关键点:
实现代码:
1、数据格式
2、设置显示样式
var style = new OpenLayers.Style({
fillColor: "#ffcc66",
strokeColor: "#ff9933",
strokeWidth: 2,
label: "${count}",
fontColor: "#333333",
fontFamily: "sans-serif",
fontWeight: "bold"
}, {
rules: [
new OpenLayers.Rule({
minScaleDenominator: 100000000,
symbolizer: {
pointRadius: 7,
fontSize: "9px"
}
}),
new OpenLayers.Rule({
maxScaleDenominator: 100000000,
minScaleDenominator: 50000000,
symbolizer: {
pointRadius: 10,
fontSize: "11px"
}
}),
new OpenLayers.Rule({
maxScaleDenominator: 50000000,
symbolizer: {
pointRadius: 13,
fontSize: "13px"
}
})
]
});
3、添加矢量图层
var features = new Array();
for (var i=0; i
程序完整代码为;
openlayers map