Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple maker on the same place with leaflet

I tried to display a lot of marker on a leaflet map. The data of the marker - coordinates, text... - are stored in a text file. I made a parser who parse the text, put the data in a big array and then i loop on this array to display each marker.

My problem here is that i got many markers - more than 200, and many of them got the same coordinates.

My code loops well but display only the last marker with each coordinates, how can i display them all properly?

like image 817
Xavier Avatar asked Mar 02 '26 00:03

Xavier


1 Answers

After digging the web around i find a solution which seems to pretty fit my issue. Leaflet allows you to create "markercluster" which can gather marker together.

Here is a live example : http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld.388.html

like image 99
Xavier Avatar answered Mar 06 '26 14:03

Xavier