View source: R/layers_icon-layer.R
add_icon_layer | R Documentation |
The IconLayer
renders raster icons at given coordinates.
add_icon_layer( deckgl, data = NULL, properties = use_default_icon_properties(), ..., id = "icon-layer" )
deckgl |
A deckgl widget object. |
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. The |
... |
Named arguments that will be added to the |
id |
The unique id of the layer. |
https://deck.gl/#/documentation/deckgl-api-reference/layers/icon-layer
## @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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.