addTangram | R Documentation |
Adds a Tangram layer to a Leaflet map in a Shiny App.
addTangram(map, scene = NULL, layerId = NULL, group = NULL, options = NULL)
map |
a map widget object created from |
scene |
Path to a required .yaml or .zip file. If the file
is within the |
layerId |
the layer id |
group |
the name of the group the newly created layers should belong to
(for |
options |
A list of further options. See the app in the
|
the new map
object
Only works correctly in a Shiny-App environment.
https://github.com/tangrams/tangram
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.