Skip to contents

arc_map_proxy() wraps a map that is already on screen. set_basemap(), set_view() and add_layer() all work on the result, and arc_update() sends the accumulated changes to the browser as one message.

Usage

ArcMapProxy(
  layers = list(),
  widgets = list(),
  basemap = NA_character_,
  center = integer(0),
  zoom = NA_real_,
  extent = list(),
  highlight = list(),
  output_id = NA_character_,
  session = NULL
)

arc_map_proxy(output_id, session = shiny::getDefaultReactiveDomain())

Arguments

output_id

Defines which arcgisMapOutput() to update.

session

default shiny::getDefaultReactiveDomain(). Defines the Shiny session to send through.

Value

An ArcMapProxy, which add_layer() and the map set_*() functions accept.

Details

Only what changed crosses the wire. A basemap or view change carries no data at all, and a layer already drawn is never resent - it is filtered, highlighted, hidden or removed in place by set_filter(), set_selection(), set_layer() and remove_layer().

A layer added through a proxy must be named, because the name is what identifies it to those functions. Adding one whose name is already on the map replaces it.

Examples

# Inside a Shiny server:
if (interactive()) {
  arc_map_proxy("map") |>
    set_basemap("satellite") |>
    arc_update()
}