I use the booklet package in R to create a map with a lot of circles on it. A goal is a map that I can publish on my website. The problem that I am facing is that as the number of laps increases, the resulting map loads very slowly, I get a “refractory script” warning and ultimately freezes my browser completely.
I know this is possible because I found a flyer card that works the way I want mine to work:
http://cartologic.com/geoapps/map_viewer/5/ny-crimes-2014-dot-density-map
I noticed on the map above that the circles don't appear as “clickable” like the circles on my map, and that they seem to load into square pieces. I have a suspicion that these things are related to my problem. Unfortunately, I am too new to flyer / javascript materials to figure it out on my own.
Here is a toy example illustrating my problem:
library("leaflet") library("htmlwidgets") dots <- data.frame(x=c(runif(10000, -93.701281, -93.533053)), y=c(runif(10000, 41.515962, 41.644369))) m <- leaflet(dots) %>% addTiles('http://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png') %>% setView(-93.617167, 41.580166, zoom = 12) %>% addCircles(~x, ~y, weight = 1, radius = 5, color = "#FFA500", stroke = TRUE, fillOpacity = 0.1) m saveWidget(widget = m, file="example.html", selfcontained = TRUE)
source share