if (interactive()) {
# 'position' and 'content' are InfoWindow parameters from AMap API
am.init() |>
am.cmd('set', 'InfoWindow', position=c(116.6, 40), content='Beijing')
am.proxy("plot") |>
am.cmd('getLayers', 'map',
f= 'function(yy) { return yy.map(x => { return x.CLASS_NAME;}); }',
r= 'result1')
}
Run the code above in your browser using DataLab