leaflet icon indicating copy to clipboard operation
leaflet copied to clipboard

Upper Limit on Number of Markers?

Open jeff-mettel opened this issue 10 years ago • 2 comments

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!

jeff-mettel avatar Mar 07 '16 02:03 jeff-mettel

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.

bhaskarvk avatar Mar 07 '16 18:03 bhaskarvk

Thanks @bhaskarvk!

Closing this issue as:

  1. The workaround you suggested is certainly an option.
  2. 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!

jeff-mettel avatar Jun 05 '16 15:06 jeff-mettel