Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

317
Views
Leaflet.js markerCluster Performace Issue

I drew markers on the map by using leaflet.js library (It's about 8500 markers). But the performance was so poor that I used markerCluster. But It also takes too much time to draw the markers. Is there any way to improve performance?

let _handler = this;

//get marker data
let data = _handler.getData();

//create markerCluster
let markers = L.markerClusterGroup({
            chunkedLoading:true, 
            removeOutsideVisibleBounds:true, 
            animate:false, 
            showCoverageOnHover:false,
            disableClusteringAtZoom:17,
            iconCreateFunction:function(cluster){
                let className = count >= 100 ? 'max-cluster-icon' : count < 100 && count >= 20 ? 'med-cluster-icon' : 'min-cluster-icon'; 
                let icon = L.divIcon({
                    html:`<div class="cluster-icon ${className}"><div><span>${cluster._childCount}</span></div></div>`
                });
                return icon;
            }});

var markerList = [];

data.forEach((val)=>{
            let {lat, lng} = val;
            if(lat && lng){
                        let icon = _handler.icons.get("icon-normal");
                        icon.options.iconSize = [30,30];
                        
                        let marker = L.marker([lat, lng], {icon:icon});
                        let html = getPopup(val);
                        marker.bindPopup(html);
                        markerList.push(marker);
            }
});

//add marker list to the markerCluster
markers.addLayers(markerList);
//add markerCluster to the map
map.addLayer(markers);
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!