Adds a GPU-rendered line/path layer.
Usage
add_lines(
map,
data = NULL,
color = "#3388ff",
opacity = 1,
width = 1,
tooltip = NULL,
popup = NULL,
id = NULL,
group = NULL,
pickable = TRUE,
width_units = c("pixels", "meters", "common"),
width_min_pixels = NULL,
width_max_pixels = NULL
)Arguments
- map
A maplamina widget created by
maplamina().- data
Data for this layer. Typically an
sfobject with LINESTRING geometry.- color, opacity, width
Line color/opacity/width.
- tooltip, popup
Optional
tmpl()objects (orNULL) for hover/click content.- id, group
Optional layer id and group name.
- pickable
Logical; whether features can be picked (tooltip/popup).
- width_units
Units for
width; one of"meters","pixels", or"common".- width_min_pixels, width_max_pixels
Optional clamp in pixels when using meter/common units.
Examples
if (requireNamespace("sf", quietly = TRUE)) {
ln <- sf::st_sfc(
sf::st_linestring(matrix(c(-122.4, 37.8, -122.5, 37.85), ncol = 2, byrow = TRUE)),
crs = 4326
)
ln <- sf::st_sf(id = 1, geometry = ln)
maplamina(ln) |>
add_lines(color = "black", width = 3)
}