add_text_layer {deckgl}R Documentation

Add a text layer to the deckgl widget

Description

The TextLayer renders text labels on the map using texture mapping.

Usage

add_text_layer(deckgl, id = "text-layer", data = NULL,
  properties = list(), ...)

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/text-layer

Examples

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

deck <- deckgl(zoom = 10, pitch = 35) %>%
  add_text_layer(
    data = bart_stations,
    pickable = TRUE,
    getPosition = ~lng + lat,
    getText = ~name,
    getSize = 15,
    getAngle = 0,
    getTextAnchor = "middle",
    getAlignmentBaseline = "center",
    tooltip = "{{name}}<br/>{{address}}"
  ) %>%
  add_basemap(use_carto_style("voyager"))

if (interactive()) deck

[Package deckgl version 0.2.7 Index]