Learn R Programming

deckgl (version 0.2.5)

add_raster_tile_layer: Add a raster tile layer to the deckgl widget

Description

EXPERIMENTAL, see https://deck.gl/#/examples/core-layers/tile-layer

Usage

add_raster_tile_layer(deckgl, id = "raster-tiles",
  tileServer = "https://c.tile.openstreetmap.org/",
  properties = list(), ...)

Arguments

deckgl

deckgl widget

id

id of the layer

tileServer

base url of the tile server

properties

named list of properties with names corresponding to the properties defined in the deckgl-api-reference for the given layer class, additionally there is a getTooltip property (callback) showing a tooltip when the mouse enters an object, e. g. getTooltip = JS("object => object.name")

...

more properties (will be added to the properties object), useful if you want to use a properties object for more than one layer

Examples

Run this code
# NOT RUN {
## @knitr raster-tile-layer
tile_servers <- list(
  osm = "https://a.tile.openstreetmap.org/",
  carto_light = "https://cartodb-basemaps-a.global.ssl.fastly.net/light_all/",
  carto_dark = "https://cartodb-basemaps-a.global.ssl.fastly.net/dark_all/",
  stamen_toner = "http://a.tile.stamen.com/toner/"
)

deck <- deckgl() %>%
  add_raster_tile_layer(
    tileServer = tile_servers$osm,
    pickable = TRUE,
    autoHighlight = TRUE,
    highlightColor = c(60, 60, 60, 40)
  )

if (interactive()) deck
# }

Run the code above in your browser using DataLab