leaflet
leaflet copied to clipboard
Upper Limit on Number of Markers?
I notice very odd behavior when adding a large number of markers to a map (~1000 in the United States, for example - although the behavior can happen with fewer makers as well). The odd behavior includes:
- Failure to render all expected points
- Inability to zoom in / pan map (E.g. Essentially, it just freezes)
I suspect there is an underlying upper limit causing these performance issues, but I can't seem to find any concrete documentation confirming this.
Thanks!
Use the marker cluster option
leaflet(quakes) %>% addTiles() %>% addMarkers(
clusterOptions = markerClusterOptions()
)
e.g. http://rpubs.com/bhaskarvk/WindFarms-In-USA WARNING : Very slow load, but it works.
Thanks @bhaskarvk!
Closing this issue as:
- The workaround you suggested is certainly an option.
- A potentially better option is to dynamically add only those points within the map's currently visible window (and having a maximum number of points if zoomed way out). Unfortunately, this results in another issue as documented in #271.
Cheers!