Bernd Strehl
Bernd Strehl

Reputation: 2920

Custom clustering by id

I'm using leaflet markercluster to display a high amount of markers in a nice and more performant way when zooming out. I load the markers from an array. Each marker has x and y coordinates as well as a block-id. Unfortunately the clustering plugin creates the clustering not like I want.

Let's take this as an example: enter image description here

The diamonds are markers and the red boxes are blocks, meaning markers in the same red box have the same block-id. I want the clustered by the block when I zoom out, but they are clustered in an other way (yellow boxes).

Is there any way to achieve what I want?

Upvotes: 1

Views: 235

Answers (1)

Liedman
Liedman

Reputation: 10329

I would try to create one MarkerClusterGroup per block id; that way, clusters in each group will only contain markers from the same block id.

Upvotes: 2

Related Questions