【发布时间】:2019-09-24 07:14:51
【问题描述】:
在使用集群层显示标记的地图上,在 API 调用加载数据时重新加载我需要清除地图中的集群标记请帮助解决这个问题,使用当前方法清除普通标记(map.removeObjects(map.removeObjects(map.removeObjects(map.removeObjects)) getObjects()) 它作为例外工作,但我需要删除默认集群标记
请找到以下代码:
startClustering(map, data) {
// First we need to create an array of DataPoint objects,
// for the ClusterProvider
// tslint:disable-next-line:ter-prefer-arrow-callback
const dataPoints = data.map(function (item) {
console.log('item>>>>', item);
return new H.clustering.DataPoint(item.y, item.x);
});
const clusteredDataProvider = new H.clustering.Provider(dataPoints, {
clusteringOptions: {
// Maximum radius of the neighbourhood
eps: 1,
// minimum weight of points required to form a cluster
minWeight: 2,
},
});
// Create a layer tha will consume objects from our clustering provider
const clusteringLayer = new H.map.layer.ObjectLayer(clusteredDataProvider);
// To make objects from clustering provder visible,
// we need to add our layer to the map
map.addLayer(clusteringLayer);
}
我需要在调用这个函数之前删除这个簇标记
【问题讨论】:
标签: here-api