New to Telerik UI for WinForms? Download free 30-day trial


RadMap supports clusterization of its layers allowing grouping of their items. This feature is extremely useful when dealing with large collections having items located close to each other.

Figure 1: Clustering

WinForms RadMap Clustering

Clusterization Modes

The ClusterDistance property of a certain layer is responsible for setting a distance according to which each of the layer items will be evaluated to form a group. There are two types of clusters which can be assigned to the ClusterStrategy property of the layer:

  • ElementClusterStrategy: All of the layer items are evaluated and a cluster is being created on the exact coordinates of an item within the cluster.

  • DistanceClusterStrategy: All of the layer items are evaluated and a cluster is being created on the geographic center of the items part of the cluster.

The example below creates a layer with four MapPin elements and defines clusters using ElementClusterStrategy and DistanceClusterStrategy having the same ClusterDistance.

Add Layer and Data

private void SetupLayers()
    MapLayer easternLayer = new MapLayer("CitiesLayer");

private void SetupData()
    MapPin element = new MapPin(new PointG(40.4467648, -80.01576030));
    element.Text = "Pittsburgh";
    element.BackColor = Color.Red;
    element = new MapPin(new PointG(40.8130697, -74.07439790));
    element.Text = "New York";
    element.BackColor = Color.Green;
    element = new MapPin(new PointG(42.3665137, -71.06160420));
    element.Text = "Boston";
    element.BackColor = Color.Blue;
    element = new MapPin(new PointG(43.6434661, -79.37909890));
    element.Text = "Toronto";
    element.BackColor = Color.Yellow;

Private Sub SetupLayers()
    Dim easternLayer As New MapLayer("CitiesLayer")
End Sub
Private Sub SetupData()
    Dim element As New MapPin(New PointG(40.4467648, -80.0157603))
    element.Text = "Pittsburgh"
    element.BackColor = Color.Red
    element = New MapPin(New PointG(40.8130697, -74.0743979))
    element.Text = "New York"
    element.BackColor = Color.Green
    element = New MapPin(New PointG(42.3665137, -71.0616042))
    element.Text = "Boston"
    element.BackColor = Color.Blue
    element = New MapPin(New PointG(43.6434661, -79.3790989))
    element.Text = "Toronto"
    element.BackColor = Color.Yellow
End Sub

Figure 2: Initial Result

WinForms RadMap Initial Result


private void SetElementCluster()
    this.radMap1.Layers[0].ClusterStrategy = new ElementClusterStrategy();
    this.radMap1.Layers["CitiesLayer"].ClusterDistance = 200;

Private Sub SetElementCluster()
    Me.RadMap1.Layers(0).ClusterStrategy = New ElementClusterStrategy()
    Me.RadMap1.Layers("CitiesLayer").ClusterDistance = 200
End Sub

Figure 3: ElementClusterStrategy

WinForms RadMap ElementClusterStrategy


private void DistanceElementCluster()
    this.radMap1.Layers[0].ClusterStrategy = new DistanceClusterStrategy();
    this.radMap1.Layers["CitiesLayer"].ClusterDistance = 200;

Private Sub SetDistanceCluster()
    Me.RadMap1.Layers(0).ClusterStrategy = New DistanceClusterStrategy()
    Me.RadMap1.Layers("CitiesLayer").ClusterDistance = 200
End Sub

Figure 4: DistanceClusterStrategy

WinForms RadMap DistanceClusterStrategy

See Also

In this article