Learn R Programming

mapview (version 1.1.0)

mapshot: Save mapview or leaflet map as HTML and/or image

Description

Save a mapview or leaflet map as .html index file or .png, .pdf, or .jpeg image.

Usage

mapshot(x, url = NULL, file = NULL, remove_url = TRUE, ...)

Arguments

x
mapview or leaflet object.
url
Output .html file. If not supplied and 'file' is specified, a temporary index file will be created.
file
Output .png, .pdf, or .jpeg file.
remove_url
logical. If TRUE (default), the .html file is removed once processing is completed. Only applies if 'url' is not specified.
...
Further arguments passed on to webshot.

See Also

webshot, saveWidget.

Examples

Run this code
## Not run: 
# m <- mapview(breweries91)
# 
# ## create standalone .html
# mapshot(m, url = paste0(getwd(), "/map.html"))
# 
# ## create standalone .png; temporary .html is removed automatically unless
# ## 'remove_url = FALSE' is specified
# mapshot(m, file = paste0(getwd(), "/map.png"))
# 
# ## create .html and .png
# mapshot(m, url = paste0(getwd(), "/map.html"),
#         file = paste0(getwd(), "/map.png"))
# ## End(Not run)

Run the code above in your browser using DataLab