Skip to contents

Add deck.gl layers to the map

Usage

add_deck_layers(.map, layers, tooltip = NULL)

Arguments

.map

A maplibre() HTML widget

layers

A list of deck.gl layers.

tooltip

Either a single mustache template string applied to all layers or a dictionary where keys are layer ids and values are mustache template strings.

Value

The updated maplibre() HTML widget

Examples

deck_grid_layer <- list(
  "@@type" = "GridLayer",
  id = "GridLayer",
  data = "https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/sf-bike-parking.json",
  extruded = TRUE,
  getPosition = "@@=COORDINATES",
  getColorWeight = "@@=SPACES",
  getElevationWeight = "@@=SPACES",
  elevationScale = 4,
  cellSize = 200,
  pickable = TRUE
)

setup <- mapOptions(
  center = c(-122.4, 37.74),
  zoom = 12,
  pitch = 40,
  hash = TRUE
)

maplibre(setup, deck = TRUE) |>
  add_deck_layers(list(deck_grid_layer))