R - Leaflet Limitations - How many markers does a leaflet map support?

落花浮王杯 提交于 2019-12-02 09:01:14

There are a couple options I can think that might help. The best would probably be to make clusters (see Marker Clusters):

addMarkers(..., clusterOptions = markerClusterOptions())

This prevents all 35 000 points from rendering at once which speeds up the loading time.

addCircles() and addCircleMarkers() seem to load quicker than addMarkers() as well if they're okay for your purposes although they're still slow with 35 000 points.

You could then do:

addCircleMarkers(..., clusterOptions = markerClusterOptions())

which should load even faster.

Update

Use leaflet.glify (devtools::install_github("tim-salabim/leaflet.glify"))

See leaflet.glify

An approach I did use recently to plot more than 100k points and worked very well:

leaflet(options = leafletOptions(preferCanvas = TRUE))

This forces leaflet to render the map as canvas. More info here.

The map appearance keep the same, but is much more fast in terms of navigation. I didn't try leaflet.glify yet, but is a good solution for thousand points using leaflet package.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!