5

I'm using Leaflet to visualize a large number of points on a map. The points don't need to be very fancy, I just need to be able to set a radius (doesn't matter if it's pixels or meters, I just need relative size differences), and a color on them.

So I'm thinking that L.Circle and L.CircleMarker are overkill for this purpose. With 7000 points, the map lags quite a lot. Are there any markers that are more light-weight than L.Circle/L.CircleMarker? Some kind of markers that doesn't need complicated radius calculations or a lot of different drawing settings?

If not, any other way I can get better performance with that many markers? I tried with a conditionalLayer, but it's too slow to update, since it has to remove and re-add everything for every zoom or pan (which takes 2-3 seconds every time). It is important that I am able to show all the markers (up to 10 000) when zoomed out.

(Note: I have already activated the L_PREFER_CANVAS setting, which did make a difference, but it's still laggy.)

closed as too broad by whyzar, Mapperz Feb 10 '17 at 15:46

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

4

I think that your problem is not that "markers are overkill", but rather that the redraw updates are killing your performance.

Approaches to tiling the rendering calls such as https://carto.com/torque/ or https://github.com/Leaflet/Leaflet.VectorGrid (particularly VectorGrid.Slicer for this use case) should help minimize the redraws.

Otherwise, consider using a different visualization such as clustering or heatmaps.

Not the answer you're looking for? Browse other questions tagged or ask your own question.