1
Q
组标记3.
A
回答
2
你有一些例子,可以把你在正确的方向,对于初学者来说,你可以看看这里:
的OpenLayers正式例如:Clustered Features
的OpenLayers扩展:Animated Cluster
的OpenLayers扩展名:Convex Hull
周的OpenLayers示例(3的OpenLayers初学者指南):Cluster GeoJSON Source
和这个小片断,以及;
var map = new ol.Map({
view: new ol.View({
zoom: 4,
center: [2152466, 5850795]
}),
target: 'js-map',
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
]
});
// generate random elements
var getRandomInt = function(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
};
var features = [];
var numberOfFeatures = 0;
while (numberOfFeatures < 100) {
var point = new ol.geom.Point([
getRandomInt(1545862, 2568284),
getRandomInt(6102732, 7154505)
]);
features.push(new ol.Feature(point));
numberOfFeatures++;
}
var getStyle = function(feature) {
var length = feature.get('features').length;
return [
new ol.style.Style({
image: new ol.style.Circle({
radius: Math.min(
Math.max(length * 0.8, 10), 15
),
fill: new ol.style.Fill({
color: [0, 204, 0, 0.6]
})
}),
text: new ol.style.Text({
text: length.toString(),
fill: new ol.style.Fill({
color: 'black'
})
}),
stroke: new ol.style.Stroke({
color: [0, 51, 0, 1],
width: 1
}),
font: '26px "Helvetica Neue", Arial'
})
];
};
// https://github.com/Viglino/OL3-AnimatedCluster
var clusterSource = new ol.source.Cluster({
distance: 100,
source: new ol.source.Vector({
features: features
})
});
// Animated cluster layer
var clusterLayer = new ol.layer.AnimatedCluster({
source: clusterSource,
// Use a style function for cluster symbolisation
style: getStyle
});
map.addLayer(clusterLayer);
.map {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
font-family: Arial, sans-serif;
}
.ol-attribution > ul {
font-size: 1rem;
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Clusters</title>
<link rel="stylesheet" href="https://openlayers.org/en/v4.3.3/css/ol.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="js-map" class="map"></div>
<script src="https://openlayers.org/en/v4.3.2/build/ol.js"></script>
<!--animated cluster plugin -->
<script type="text/javascript" src="https://cdn.rawgit.com/Viglino/OL3-AnimatedCluster/gh-pages/interaction/selectclusterinteraction.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/Viglino/OL3-AnimatedCluster/gh-pages/layer/animatedclusterlayer.js"></script>
<script src="clustering.js"></script>
</body>
</html>
相关问题
- 1. Bootstrap 3标记
- 2. 在Rails 3中标记3
- 3. 标记的OpenLayers 3
- 4. MVC 3 - img alt HTML标记?
- 5. Rails 3标记问题,acts_as_taggable_on
- 6. 定制验证标记(3)
- 7. openlayers中的旋转标记(图标)3
- 8. 查找标记错误(分组标记)
- 9. OpenLayers 3中的图标阴影标记3
- 10. 获取multiselect选择标记值作为rails中的数组3
- 11. ASP.NET MVC 3/4 ValidationMessageFor无html标记
- 12. Uploadify和rails 3真实性标记
- 13. Rails 3 - select_tag helper - 空白选项标记
- 14. 使用ActionScript的FLV视频标记3
- 15. Rails 3中不显示HTML的标记
- 16. 在OpenLayers中动画多个标记3
- 17. 选择标记在rails 3中
- 18. 的Rails 3 - 帮助用的form_for标记
- 19. Aptana Studio 3标记发生按钮
- 20. 通知标记具有值-3
- 21. 生成淘汰赛标记在MVC 3
- 22. 限制strtok只有3个标记
- 23. 标记2D java数组
- 24. 分组标记映射
- 25. 如何在OpenLayers 3中插入半圆形标记3
- 26. TSQL:标记3天,从3个工作日前开始
- 27. 在OpenLayers 3中动态创建标记3
- 28. 从数组添加标记但仅显示一个标记
- 29. 谷歌地图 - 如何找到标记数组中的标记?
- 30. Leaflet omnivore +聚类标记+过滤标记群集组
非常感谢! –