2

I've created a map using the Leaflet package in R and added an inset locator map using addMiniMap(). I would like to add polygons features to said inset map.

I've already added the polygons to the main map. Currently, my code looks something like this (simplified), where myPolys is a SpatialDataFrame object.

map <- leaflet(myPolys) %>% addPolygons(params...) %>% addMiniMap(params...) 

Looking at the documentation for the R package here I'm not 100% sure that this is even possible. Am I right?

  • After doing a bit more research it seems to me that this would best be accomplished using Javascript code via htmlwidgets::onRender, similar to this example rpubs.com/bhaskarvk/leaflet-minimap. – Nick Nov 13 at 18:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.