add_icon_layer {deckgl}R Documentation

Add an icon layer to the deckgl widget

Description

The IconLayer renders raster icons at given coordinates.

Usage

add_icon_layer(deckgl, id = "icon-layer", data = NULL,
  properties = use_default_icon_properties(), ...)

Arguments

deckgl

A deckgl widget object.

id

The unique id of the layer.

data

The url to fetch data from or a data object.

properties

A named list of properties with names corresponding to the properties defined in the deckgl-api-reference for the given layer class.

...

More properties that will be added to the properties object. This can be useful if you want to use a properties object for more than one layer.

See Also

https://deck.gl/#/documentation/deckgl-api-reference/layers/icon-layer

Examples

## @knitr icon-layer
data("bart_stations")

properties <- list(
  iconAtlas = encode_icon_atlas(),
  iconMapping = list(marker = use_icon_definition()),
  sizeScale = 10,
  getPosition = ~lng + lat,
  getIcon = JS("d => 'marker'"),
  getSize = 5,
  getColor = JS("d => [Math.sqrt(d.exits), 140, 0]"),
  getTooltip = "{{name}}<br/>{{address}}"
)

deck <- deckgl(zoom = 10, pitch = 45) %>%
  add_icon_layer(data = bart_stations, properties = properties) %>%
  add_control("Icon Layer") %>%
  add_basemap()

if (interactive()) deck

[Package deckgl version 0.2.7 Index]