ClusterLayer Class

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.

This is the main class that provides the clustering functionality.

Constructor

ClusterLayer(pushpins: Pushpin[], options?: ClusterLayerOptions)

Methods

Name Return Type Description
clear() Clears all the data in the cluster layer.
getDisplayedPushpins() Pushpin[] Gets the pushpins that are in the current map view. If clustering is disabled, all pushpins in the clustering layer are returned.
getOptions() ClusterLayerOptions Gets the current options used by the cluster layer.
getPushpins() Pushpin[] Gets all pushpins that are in the layers.
getClusterPushpinByGridKey(gridKey:number) ClusterPushpin or Pushpin Gets the pushpin in the specified cluster grid cell which can be either a ClusterPushpin if there are multiple pushpins in a cell or a single Pushpin.
getVisible() boolean Returns a boolean indicating if the cluster layer is visible or not.
setOptions(options: ClusterLayerOptions) Sets the clustering options to use in the layer.
setPushpins(pushpins: Pushpin[]) Sets the array of pushpins that are used in the clustering layer.
setVisible(visible: boolean) Sets the visibility of the cluster layer.

Events

Name Arguments Description
click MouseEventArgs Occurs when the mouse is used to click the map or when a touch end event occurs on a pushpin or cluster in the layer.
dblclick MouseEventArgs Occurs when the mouse is used to double click the map or when a touch end event occurs on a pushpin or cluster in the layer.
mousedown MouseEventArgs Occurs when the left mouse button is pressed or a touch start event occurs on a pushpin or cluster in the layer.
mouseover MouseEventArgs Occurs when the mouse cursor moves over top of the area covered by a pushpin or cluster in the layer.
mouseout MouseEventArgs Occurs when the mouse cursor moves out of the area covered by a pushpin or cluster in the layer.
mouseup MouseEventArgs Occurs when the left mouse button is lifted up or when the touch end event occurs on a pushpin or cluster in the layer.
rightclick MouseEventArgs Occurs when the right mouse button is used to click the map or when a long touch press occurs on a pushpin or cluster in the layer.