R/mapboxgl_basemap.R

Defines functions add_mapbox_basemap

Documented in add_mapbox_basemap

#' Add a basemap from mapbox to the deckgl widget
#'
#' @param deckgl deckgl widget
#' @param style map style
#' @param token mapbox API access token
#' @return deckgl widget
#' @export
add_mapbox_basemap <- function(deckgl, style = "mapbox://styles/mapbox/light-v9",
                               token = Sys.getenv("MAPBOX_API_TOKEN")) {
  deckgl$dependencies <- c(deckgl$dependencies, use_deps("mapbox-gl"))
  deckgl$x$mapStyle <- style
  deckgl$x$mapboxApiAccessToken <- token
  deckgl
}

Try the deckgl package in your browser

Any scripts or data that you put into this service are public.

deckgl documentation built on July 1, 2020, 7:36 p.m.