The TextLayer
renders text labels on the map using texture mapping.
add_text_layer(
deckgl,
data = NULL,
properties = list(),
...,
id = "text-layer"
)
A deckgl widget object.
The url to fetch data from or a data object.
A named list of properties with names corresponding to the properties defined
in the deckgl-api-reference
for the given layer class. The properties
parameter can also be an empty list. In this case
all props must be passed as named arguments.
Named arguments that will be added to the properties
object. Identical parameters
are overwritten.
The unique id of the layer.
## @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