问题
I'm wondering if anyone else has experienced similar issues when plotting a large number of markers and polygons using leaflet package in R. This is what it normally should look like:
However, when I zoom in/out of the map, the polygons and markers are clearly out of place (or you can say the base map does not adjust properly). An example is included below:
I would not have this issue when I plotted a smaller area or few markers. I'm wondering if there is a way to improve the performance. Many thanks in advance for your help!
A sample of my code is included below:
map1 <- leaflet() %>%
addProviderTiles("CartoDB.Positron") %>%
addPolygons(data = data_merged, group="Default",
fillColor = ~pal(minority_population), color = "orange",
fillOpacity = 0.7,weight = 1, smoothFactor = 0.2, popup = popup) %>%
addMarkers(data = branches_temp, ~long, ~lat,
popup=~name_branch, group="Branch Locations",
icon=icons(iconUrl = "./data/bank_blue_marker.png",iconWidth=20, iconHeight=20))
来源:https://stackoverflow.com/questions/40063663/leaflet-r-performance-issues-with-large-map