Clustering Module
Note
Bing Maps Web Control SDK retirement
Bing Maps Web Control SDK is deprecated and will be retired. Free (Basic) account customers can continue to use Bing Maps Web Control SDK until June 30th, 2025. Enterprise account customers can continue to use Bing Maps Web Control SDK until June 30th, 2028. To avoid service disruptions, all implementations using Bing Maps Web Control SDK will need to be updated to use Azure Maps Web SDK by the retirement date that applies to your Bing Maps for Enterprise account type. For detailed migration guidance, see Migrate from Bing Maps Web Control SDK and Migrate Bing Maps Enterprise applications to Azure Maps with GitHub Copilot.
Azure Maps is Microsoft's next-generation maps and geospatial services for developers. Azure Maps has many of the same features as Bing Maps for Enterprise, and more. To get started with Azure Maps, create a free Azure subscription and an Azure Maps account. For more information about azure Maps, see Azure Maps Documentation. For migration guidance, see Bing Maps Migration Overview.
Module Name: Microsoft.Maps.Clustering
Namespace: Microsoft.Maps
Often when adding a lot of pushpins to a map, the map can become cluttered and difficult to read. The performance of the map may also degrade if there is a significant number of pushpins displayed on the map. Clustering is a method where pushpins that are close together are grouped and represented as a single pushpin, often using a different icon to indicate that it is a cluster. These cluster will break apart into their individual pushpins as the user zooms into the map. This is a great way to improve both the user experience and the performance of the map.
There are a number of different ways to calculate clusters. Common algorithms that are used for clustering pushpins include grid base, point based, and k-means. Grid based clustering is one of the fastest and can handle the most data, this is what the Clustering module uses. Grid based clustering breaks the map into a grid, and if any two pushpins are in the same grid cell they are clustered together. Once all of the pushpins that are within a grid cell are known, it can then be positioned using a couple of different mechanisms. The most natural way of representing a cluster would be to position it at the average location of all the pushpins it represents. However, by doing this it is possible that if two grid cells have a number of pushpins along a shared edge, clustered pushpins may end up overlapping. A second method would be to simply use the location of the first pushpin in the cluster. This would require no calculation and would align with at least one pushpin in the cluster, but would also have the potential of overlapping of clustered pushpins. By default, the Clustering module uses the mean average position to position a cluster, however you can change this using the clusterPlacementType
option on the layer.
lustered pushpins.