I am trying to cut a leaflet map in R, so I only show a specific municipality. I have manage to hide the remaining municipalities in the country, but that leaves the water and the rest of the world visible.
dk <- getData("GADM",country="Denmark",level=2)
frb <- dk[dk$ID_2!=10,]
leaflet() %>%
setView(lat=55.680544, lng=12.519379,zoom=13)%>%
addTiles(group="Kort") %>%
addPolygons(data = frb,
fillColor= "white",
fillOpacity = 1,
weight = 2,
color = "white")
I think I need to make a polygon of the remaining world and make it white, but I can't figure out how.
setMaxBounds
to stop people scrolling outside your area of interest?