View source: R/layers_arc-layer.R
add_arc_layer | R Documentation |
The ArcLayer
renders raised arcs joining pairs of source and target points,
specified as latitude/longitude coordinates.
add_arc_layer(deckgl, data = NULL, properties = list(), ..., id = "arc-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/arc-layer
data("bart_segments")
properties <- list(
getWidth = 12,
getSourcePosition = ~from_lng + from_lat,
getTargetPosition = ~to_lng + to_lat,
getSourceColor = "@=[Math.sqrt(inbound), 140, 0]",
getTargetColor = "@=[Math.sqrt(outbound), 140, 0]",
tooltip = use_tooltip(
html = "{{from_name}} to {{to_name}}",
style = "background: steelBlue; border-radius: 5px;"
)
)
deck <- deckgl(zoom = 10, pitch = 35) %>%
add_arc_layer(data = bart_segments, properties = properties) %>%
add_control("Arc Layer", "top-left") %>%
add_basemap()
if (interactive()) deck
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.