Home > Mobile >  Is it possible to change clustering rules in azure maps
Is it possible to change clustering rules in azure maps

Time:10-26

I am using azure maps to display markers on a map (on an ASP.NET Core 3.1 project). These markers correspond to buildings, but I don't want them to be clustered based on the positions.

Instead, I would like to cluster them based on one of their properties.

For example, say I have blue, red and green buildings using the property "color". I would like to cluster all the red buildings without the others, and same for green and blue.

I know this may lead to clusters overlapping with each others, but it's not a problem in my case.

I already tried to create multiple layers along with filters, but it didn't work :/

Maybe I'm missing something...

CodePudding user response:

To achieve this you would need to separate your data by property into separate data sources. Then enable clustering on each data source. Note that this may lead to clusters from different data sources (colors) overlapping.

An alternative approach that would be a design change for your scenario, but often is a better fit, is to use cluster aggregates combined with the HTML marker layer to create pie charts for clusters indicating the number of each color in a cluster. Here is a code sample: https://azuremapscodesamples.azurewebsites.net/?sample=Clustered Pie Chart HTML Markers

  • Related