addTangram {leaflet.extras2} | R Documentation |
Adds a Tangram layer to a Leaflet map in a Shiny App.
Description
Adds a Tangram layer to a Leaflet map in a Shiny App.
Usage
addTangram(map, scene = NULL, layerId = NULL, group = NULL, options = NULL)
Arguments
map |
A leaflet map widget |
scene |
Path to a required .yaml or .zip file. If the file
is within the |
layerId |
A layer ID |
group |
The name of the group the newly created layer should belong to
(for |
options |
A list of further options. See the app in the
|
Value
the new map
object
Note
Only works correctly in a Shiny-App environment.
References
https://github.com/tangrams/tangram
Examples
## Not run:
library(shiny)
library(leaflet)
library(leaflet.extras2)
## In the /www folder of a ShinyApp. Must contain the Nextzen API-key
scene <- "scene.yaml"
ui <- fluidPage(leafletOutput("map"))
server <- function(input, output, session) {
output$map <- renderLeaflet({
leaflet() %>%
addTiles(group = "base") %>%
addTangram(scene = scene, group = "tangram") %>%
addCircleMarkers(data = breweries91, group = "brews") %>%
setView(11, 49.4, 14) %>%
addLayersControl(baseGroups = c("tangram", "base"),
overlayGroups = c("brews"))
})
}
shinyApp(ui, server)
## End(Not run)
[Package leaflet.extras2 version 1.2.2 Index]