Skip to main content

How to: Aggregate Vector Items Using a Clusterer

  • 2 minutes to read

To aggregate vector items using the clusterer, assign a MapClustererBase class descendant to the MapDataAdapterBase.Clusterer property. Then optionally, specify the clusterer’s properties.

For example, all predefined clusterers allow you to group items before clustering and customize the appearance of cluster representatives.

To group items, assign AttributeGroupProvider to the MapClusterer.GroupProvider property. Then, set the provider’s AttributeGroupProvider.AttributeName property to location.

To customize the appearance of cluster representatives, assign the required MapItemSettings class descendant object to the MapClusterer.ClusterSettings property.

using System.Windows;
using DevExpress.Xpf.Map;

namespace ClustererSample {
    public partial class MainWindow : Window {
        public MainWindow() {
            InitializeComponent();
        }

        private void MarkerClusterer_Clustered(object sender, ClusteredEventArgs e) {
            map.ZoomToFitLayerItems();
        }
    }
}