I'm trying to save an image of my Leaflet map in my Shiny app. I'm using the mapshot function from the mapview package The map is constantly updated with markers etc via leafletProxy("map") %>% <add markers etc>
The issue appears to be with the fact the "map" is not actually a leaflet object, but rather a shiny output.
If you create the leaflet object in its own reactive expression and then pass that into the renderLeaflet and first mapshotobserver then that first save button works.
For the proxy option, I am not able to get it to work as I am getting the following error:
Warning: Error in system.file: 'package' must be of length 1
This seems to be an issue with saveWidget which is what mapshot calls. I am also not entirely sure what you are accomplishing by saving it with the proxy option that is not already being captured by the first save option. But I may be missing something.
Anyway, Here is the app with a working save button for the first option:
As a final note, please indicate when you have cross-posted your question (here is your question also on SO). This will prevent people from spending time trying to answer your question if you have already gotten an answer. Please see the FAQ about cross-posting questions:
Thanks for the reply, apologies for the cross posting!
I've given your way a go but I still don't get the markers that are added to the map on the exported map. That's the main issue, I'd like the user to be able to add their data as they go along and then export the map.