Skip to contents

Registers a per-layer views component. When multiple layers share the same bind, a single selector control is created.

Usage

add_views(
  map,
  ...,
  id = NULL,
  bind = NULL,
  position = NULL,
  layer_id = NULL,
  duration = 750,
  easing = c("smoothstep", "linear", "easein", "easeout", "easeinout", "easeInOutCubic")
)

Arguments

map

A maplamina widget created by maplamina().

...

One or more view() objects (or a single list of them).

id

Optional component id (also used as the default bind id).

bind

Bind group id for shared UI control. If omitted, defaults to id (or an auto id).

position

Optional UI position hint (applied to the control group).

layer_id

Target layer id (defaults to the most recently added layer).

duration

Animation duration (ms) for switching views.

easing

Easing function name for switching views.

Value

The modified map widget.

Examples

d <- data.frame(
  lon   = runif(1000, -60, 60),
  lat   = runif(1000, -60, 60),
  value = runif(1000, 1, 10)
)
maplamina() |>
  add_circles(d, radius = 5) |>
  add_views(
    view("magnitude", radius = ~value * 3),
    view("faint", fill_opacity = 0.2)
  )