am.cmd {amapro} | R Documentation |
Run a command
Description
Execute a command on a target element
Usage
am.cmd(id, cmd = NULL, trgt = NULL, ...)
Arguments
id |
|
cmd |
A command name string, like 'setFitView' |
trgt |
A target's name string, or 'map' for the map itself. |
... |
command attributes |
Details
am.cmd provides interaction with the map.
Commands are sent to the map itself, or to objects inside or outside it.
AMap built-in objects have predefined set of commands listed in the API.
Commands can modify an object (setZoom), but also get data from it (getCenter).
amapro introduces its own commands like set, addTo or code, described in the Introduction.
Value
A map or a map proxy
See Also
am.init code example and Introduction
Examples
if (interactive()) {
am.init() |>
am.cmd('set', 'InfoWindow', position=c(116.6, 40), content='Beijing')
}
[Package amapro version 0.1.3 Index]