Reputation: 57
I am Using Bingmaps angular-maps(Xmap) in my project and i am using clustering layer as in below Screenshot.
And on Click of a cluster the parent cluster in getting clustered again into smaller Clusters like below screenshot.
But what i want to achieve is when a user clicks on particular cluster, I want to avoid the further clustering of my Pushpins, instead i want to show all my pushpins under that cluster. Please help !!
I am using Angular-maps(xmap) Bingmap.
Stackblitz link for the infusioncode Bing-maps with clustering layer is as below.
Upvotes: 0
Views: 117
Reputation: 429
Looks like the pushpins are too close and the grid size is too big to handle it automatically.
I had similar issue and my first idea was to remove whole clustering layer, but after removing it also the containing puspins were removed
I found a solution by changing the girdsize on a certain zoom level and works like a charm
let lastZoomLevel = map.current.getZoom();
const handleChangeZoom = e => {
if (lastZoomLevel !== map.current.getZoom()) {
lastZoomLevel = map.current.getZoom();
if (map.getZoom() >= 12) {
map.layers[0].setOptions({ gridSize: 1 });
} else {
map.layers[0].setOptions({ gridSize: 80 });
}
}
}
window.Microsoft.Maps.Events.addHandler(map.current, 'viewchangeend', handleChangeZoom);
Upvotes: 0