Skip to contents

First command to build a map


am.init(..., width = NULL, height = NULL)



attributes of map, see here.
Additional attribute loca(boolean) is to add a Loca.Container to the map.

width, height

A valid CSS unit (like '100%')


A widget to plot, or to store and expand with more features


Command am.init creates a widget with createWidget, then adds features to it.
On first use, am.init prompts for AMap API key. There is a temporary demo mode when key is unavailable.


if (interactive()) {
  ctr <- c(22.430151, 37.073011)
  tu <- paste0('',
  am.init( center= ctr, zoom= 10, pitch= 60, viewMode= '3D') |>
  am.control(ctype= 'ControlBar', position= 'RT') |>
  am.item('TileLayer', tileUrl= tu) |>
  am.item('Marker', position= ctr,
      icon= ''
  ) |>
  am.cmd('set', 'InfoWindow', name='iwin', content='This is Sparta') |>
  am.cmd('open', 'iwin', 'm$jmap', ctr)   # m$jmap is the map name in JavaScript