Clustering point data in Azure Maps
Published Nov 13 2019 07:26 AM 4,686 Views
Microsoft

IoT solutions developers using location data from thousands of devices usually end up with large data sets, presenting them with particular issues. First, when map data is displayed, users have trouble seeing it because there is too much data: pins will be hidden by other pins, overlays will overlay each other, literally. Secondly, large data sets may cause performance issues: you must have experienced slow maps rendering on some platforms when trying to display too much data. The most common way to address these two issues is by clustering—or aggregating data.

Azure Maps offers the ability to cluster large data sets in many different ways so that end users can quickly extract insights from their maps while IoT developers can avoid spending long hours deciphering, filtering and displaying data.

Watch the Channel 9 IoT Show, Point clustering map data with Azure Maps, for some great live demos of Azure Maps clustering capabilities using the SDK samples:

 

 

Read on for the basics of how to enable clustering in Azure Maps and for highlights of useful clustering techniques.

 

Cluster options for radius-based clustering

To use clustering in Azure Maps, you will want to

  • set the cluster option on the DataSource class to true,
  • set the pixel radius from which nearby points will be combined into a single cluster with clusterRadius,
  • set the zoom level that will specify when to disable the clustering logic using the clusterMaxZoom option.

 

//Create a data source and enable clustering.
var datasource = new atlas.source.DataSource(null, {
      //Tell the data source to cluster point data.
      cluster: true,

      //The radius in pixels to cluster points together.
      clusterRadius: 45,

      //The maximum zoom level in which clustering occurs.
      //If you zoom in more than this, all points are rendered as symbols.
      clusterMaxZoom: 15
});

 

Full documentation for radius-based clustering.

 

Point clusters in bubble layer

A bubble layer is a great way to render clustered points. You can easily scale the radius and change the color theme based on the number of points in the cluster by using an expression.

 

Maps Cluster 1.png

Full documentation and demo sample for clustering in a bubble layer.

 

Display clusters in a symbol layer

You can also use a symbol layer to display data. Again, the goal is surface insights more easily for the user.

 

MapsCluster2.png

Full documentation and demo sample for clustering in a symbol layer.

 

Cluster aggregates

Sometimes you will want to customize the style of clusters based on some metric, like the total revenue of all points within a cluster. Azure Maps offers a cluster aggregates custom properties feature that can be created and populated using an aggregate expression calculation.

The following sample uses an aggregate expression to calculate a count based on the entity type property (grocery store, restaurant, school, etc.) of each data point in a cluster.

 

MapsCluster4.png

Full documentation and demo sample for using cluster aggregates.

 

Clustered Heat Maps

Heat maps are a great way to display the density of data on the map. This visualization can handle a large number of data points on its own, but it can handle even more data if the data points are clustered and the cluster size is used as the weight of the heat map

 

ClusterMaps5.png

Full documentation and demo sample for clustered heat maps.

 

Clustered Pie Chart HTML Markers

Clustered Pie Chart HTML Markers use cluster aggregates to surface useful information to the user without them having to even click on them. In this example, pie charts are used to show the number of gas stations, grocery stores, restaurants, and schools. 

 

MapsCluster3.png

Demo sample for using clustered Pie Chart HTML Markers.

 

... And more!

You can find even more ways to cluster data in Azure Maps in the documentation and on the SDK samples site.

Version history
Last update:
‎Nov 13 2019 07:32 AM
Updated by: