defaults {basemaps}R Documentation

Set, get and reset basemaps defaults

Description

These functions set, get or reset the defaults of all map arguments passed to basemap and associated functions.

Usage

set_defaults(
  ext = NULL,
  map_service = NULL,
  map_type = NULL,
  map_res = NULL,
  map_token = NULL,
  map_dir = NULL
)

get_defaults()

reset_defaults()

Arguments

ext

extent to be covered by the basemap as any spatial class supported by st_bbox.

map_service

character, a map service, either "osm", "carto" or "mapbox". Default is "osm".

map_type

character, a map type, e.g. "streets". For a full list of available map types, see get_maptypes.

map_res

numeric, resolution of base map in range from 0 to 1.

map_token

character, authentication token for services that require registration, which are "osm_stamen", "osm_stadia", "osm_thunderforest" and "mapbox". Register at https://stadiamaps.com/ (for stamen and stadia), https://www.thunderforest.com/ and/or https://www.mapbox.com/ to get tokens. Ignored for all other map services.

map_dir

character, cache directory where downloaded basemap tiles will be stored. By default, a temporary directory is used, which is destroyed when the session is terminated.

Value

For get_defaults, a list of defaults, otherwise none.

Examples

library(basemaps)
data(ext)

# set defaults for the basemap
set_defaults(ext = ext, map_service = "osm", map_type = "terrain_bg")

# get defaults
get_defaults()

## Not run: 
# load and return basemap map as raster (default)
map <- basemap()

## End(Not run)

# reset defaults
reset_defaults()


[Package basemaps version 0.0.7 Index]