你知道如何在像这个google example这样的OpenLayers中拥有一个好的集群吗?
发布于 2012-08-03 07:37:48
您可以在上面的示例中向pointStyle添加label,并解释此label的上下文。你的代码应该是这样的:
var pointStyle = new OpenLayers.Style({
// ...
'label': "${label}",
// ...
}, {
context: {
// ...
label: function(feature) {
// clustered features count or blank if feature is not a cluster
return feature.cluster ? feature.cluster.length : "";
}
// ..
}
});
var styleMap = new OpenLayers.StyleMap({
'default': pointStyle,
});
var googleLikeLayer = new OpenLayers.Layer.Vector("GoogleLikeLayer", {
// ...
styleMap : styleMap,
// ...
});发布于 2011-07-11 00:15:20
使用OpenLayers.Strategy.Cluster进行群集。
发布于 2012-08-23 04:38:19
我刚刚为OpenLayers实现了一个所谓的AnimatedCluster策略。有关它的更多信息,请访问:http://www.acuriousanimal.com/2012/08/19/animated-marker-cluster-strategy-for-openlayers.html
这只是一个第一个版本,但增加了一个很好的动画集群。有很多地方需要改进,但这只是一个起点。
https://stackoverflow.com/questions/6641919
复制相似问题