This is a migrated thread and some comments may be shown as answers.

Clustered Data Source

1 Answer 45 Views
Map
This is a migrated thread and some comments may be shown as answers.
Adnan
Top achievements
Rank 1
Adnan asked on 20 Jul 2012, 08:54 AM
Hi,

I'm currently exploring the use of the Clustered Data Source to improve performance when displaying a large number of map items.

Can the Clustered Data Source be setup so that it is only active for certain zoom levels?

The scenario is displaying a very large number of map items, when you are zoomed out, a number of points overlap and rather then having these all displayed, the Clustered Data Source would be used.  However when zoomed in to Zoom Level 15 >, we would want all the map items displayed without any Clustered Data Source.

Many Thanks,

Adnan

1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 24 Jul 2012, 03:36 PM
Hello Adnan,

No, you can't do it this way. But there is another approach which you can use. 

Clustered data source provides functionality for grouping of the geographic locations using some criteria.The default implementation uses distance in degrees between 2 locations as grouping condition. It can be changed at any time by creation of the new class which implements IClusterItemGenerator or which inherits from the ClusterItemGenerator class (the default built-in implementation of the grouping condition). For example:

/// <summary>
/// Custom cluster item generator.
/// </summary>
public class CustomClusterItemGenerator : ClusterItemGenerator
{
    public override bool IsItemInClusterRegion(ClusterItem cluster, object dataItem, int zoomLevel)
    {
        if (zoomLevel >= 10)
        {
            return false;
        }
        else
        {
            return base.IsItemInClusterRegion(cluster, dataItem, zoomLevel);
        }
    }
}

public MainWindow()
{
    InitializeComponent();
 
    ClusteredDataSource dataSource = this.informationLayer.ClusteredDataSource;
    CustomClusterItemGenerator generator = new CustomClusterItemGenerator();
    dataSource.ClusterItemGenerator = generator;
}

All the best,
Andrey Murzov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Map
Asked by
Adnan
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or