Skip to content

How to cluster bunch of markers? #50

Answered by dimfeld
FluffyDiscord asked this question in Q&A
Discussion options

You must be logged in to vote

No, it only supports MapLibre's built-in clustering functionality right now, which in turn only works with GeoJSON.

The most straightforward way would be to convert the data to GeoJSON for display, which is basically a matter of converting to something like this:

{
  "type": "FeatureCollection",
   "features": [
      {
          "type": "Feature",
          "id": marker.id,
           "properties": { /* any additional props here, such as text to display, color, etc. */ },
           "geometry": {
               "type": "Point",
               "coordinates": marker.position
            }
      },
      // Additional markers here
   ]
}

Libraries such as turf can take out some of the busyw…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by FluffyDiscord
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants