Skip to contents

Adds a point icon layer. Icons are referenced by id (resolved in the frontend icon set).

Usage

add_icons(
  map,
  data = NULL,
  lon = NULL,
  lat = NULL,
  icon = "marker",
  size = 18,
  color = "#3388ff",
  opacity = 1,
  tooltip = NULL,
  popup = NULL,
  id = NULL,
  group = NULL,
  pickable = TRUE,
  size_units = c("pixels", "meters", "common"),
  size_min_pixels = NULL,
  size_max_pixels = 64,
  icon_anchor = NULL,
  mask = TRUE,
  occlude = FALSE
)

Arguments

map

A maplamina widget created by maplamina().

data

Data for this layer. If NULL, uses the default data supplied to maplamina().

lon, lat

Longitude/latitude aesthetics (formula or scalar). Required for non-sf data.

icon

Icon id string (e.g. "marker").

size, color, opacity

Icon size and color/opacity (can be formulas).

tooltip, popup

Optional tmpl() objects (or NULL) for hover/click content.

id, group

Optional layer id and group name.

pickable

Logical; whether features can be picked (tooltip/popup).

size_units

Units for size; one of "pixels", "meters", or "common".

size_min_pixels, size_max_pixels

Optional clamp in pixels when using meter/common units.

icon_anchor

Optional anchor (frontend-specific).

mask

Logical; whether to mask the icon.

occlude

Logical; whether icons occlude each other.

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_icons(d, icon = "star", size = 20)