5

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:

Heat map of minority population in DMV area

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:

Same map when zoomed in

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))
alistaire
  • 42,459
  • 4
  • 77
  • 117
Sean
  • 51
  • 4
  • 1
    This is an interesting question, but it looks like more of a Leaflet bug than an R issue. If you can [make this reproducible](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) by including sufficient data, you might open an issue [on GitHub](https://github.com/rstudio/leaflet/) (after checking to make sure there are no similar ones open, of course). – alistaire Oct 23 '16 at 16:02
  • Does this happen when you are editing it, or is it working this way in a browser? Does it work this way in all browsers? On more than one computer? It could be a bug OR it could be a browser issue. My experience has been that maps DO NOT test right in the console of rStudio at all! – sconfluentus Jan 27 '17 at 04:58

0 Answers0