(CC-BY-NC-SA)

This document was produced on So Jun 12 2016 using mapview version 1.1.0


mapviewOptions() can be used to set several plotting parameters (arguments) globally, meaning that they will be valid for as long as the session is active.

A call to mapviewOptions() will show all options and their default values in the console

library(mapview)

mapviewOptions()
## platform            : leaflet 
## basemaps            : CartoDB.Positron OpenStreetMap Esri.WorldImagery Thunderforest.Landscape OpenTopoMap 
## raster.size         : 8388608 
## mapview.maxpixels   : 5e+05 
## plainview.maxpixels : 1e+07 
## maxpolygons         : 30000 
## maxpoints           : 20000 
## maxlines            : 30000 
## raster.palette      : 
## function (n, alpha = 1, begin = 0, end = 1) 
## {
##     viridis(n, alpha, begin, end, option = "inferno")
## }
## <environment: namespace:viridisLite>
## 
## vector.palette      : 
## function (n, alpha = 1, begin = 0, end = 1, option = "D") 
## {
##     if (begin < 0 | begin > 1 | end < 0 | end > 1) {
##         stop("begin and end must be in [0,1]")
##     }
##     option <- switch(option, A = "A", magma = "A", B = "B", inferno = "B", 
##         C = "C", plasma = "C", D = "D", viridis = "D", {
##             warning(paste0("Option '", option, "' does not exist. Defaulting to 'viridis'."))
##             "D"
##         })
##     map <- viridisLite::viridis.map[viridisLite::viridis.map$opt == 
##         option, ]
##     map_cols <- grDevices::rgb(map$R, map$G, map$B)
##     fn_cols <- grDevices::colorRamp(map_cols, space = "Lab", 
##         interpolate = "spline")
##     cols <- fn_cols(seq(begin, end, length.out = n))/255
##     grDevices::rgb(cols[, 1], cols[, 2], cols[, 3], alpha = alpha)
## }
## <environment: namespace:viridisLite>
## 
## verbose             : FALSE 
## na.color            : #BEBEBE80 
## legend              : FALSE 
## legend.pos          : topright 
## layers.control.pos  : topleft 
## leafletWidth  : 
## leafletHeight  :

In detail, these are:


To get the current value of a certain option use mapviewGetOption()

mapviewGetOption("basemaps")
## [1] "CartoDB.Positron"        "OpenStreetMap"          
## [3] "Esri.WorldImagery"       "Thunderforest.Landscape"
## [5] "OpenTopoMap"

To set certain options use mapviewOptions()

library(RColorBrewer)

mapviewOptions(basemaps = c("CartoDB.DarkMatter", "OpenStreetMap.DE"),
               raster.palette = colorRampPalette(brewer.pal(9, "Greys")),
               vector.palette = colorRampPalette(brewer.pal(9, "YlGnBu")),
               na.color = "magenta",
               layers.control.pos = "topright")

mapview(breweries91, zcol = "founded", legend = TRUE)

These options will now be available until the current session is closed. i.e. you quit R

mapview(poppendorf[[5]])
viewRGB(poppendorf, 5, 4, 3)

To change these options permanently, i.e. across sessions, you could place a call to mapviewOptions() in your .Rprofile so that they will be set everytime you start R