Skip to contents

Create a Map Object for MapLibre GL

Usage

maplibre(
  map_options = mapOptions(),
  deck = FALSE,
  width = "100%",
  height = NULL,
  element_id = NULL,
  ...
)

Arguments

map_options

mapOptions()

deck

Whether to add deck.gl HTML dependency.

width, height

The width and the height of the widget.

element_id

The unique ID of the widgets's HTML element.

...

Further map options.

Examples

map_options <- mapOptions(
  center = c(-123.1256, 49.24658),
  hash = TRUE,
  pitch = 0,
  style = basemaps$carto$dark_matter
  )

# add control uses add_call to add a control to the map widget
maplibre(map_options, zoom = 12) |>
  add_control("NavigationControl", "top-left", showCompass = FALSE)
# this is equal to: maplibre(map_options, zoom = 12) |> add_call("addControl", "NavigationControl", list(showCompass = FALSE), "top-left")