Szecskkaa
Szecskkaa

Reputation: 43

Render 10000 polylines to a leaflet map

What is the best way to render nearly 10000 polylines to a leaflet map? I need my map to be interactive(hover events). Currently I am using leaflet 1.0 beta with canvas renderer. There is no problem with Chrome but Firefox seems to be much slower at this number of polylines.

Thanks

Upvotes: 2

Views: 2800

Answers (1)

borisrorsvort
borisrorsvort

Reputation: 906

If the issue is only appearing in firefox, it may be because Firefox seems not very good at rendering many many SVG. One solution that worked for me is to switch the renderer to Canvas.

var map = L.map('map', {
  renderer: L.canvas()
});

I can report 10 000 markers and zones with hovers and tooltip working smoothly

A link to the documentation

Upvotes: 3

Related Questions