Skip to content

Instantly share code, notes, and snippets.

@aagarw30
Last active February 7, 2016 17:04
Show Gist options
  • Save aagarw30/709c46366910a5c8ce34 to your computer and use it in GitHub Desktop.
Save aagarw30/709c46366910a5c8ce34 to your computer and use it in GitHub Desktop.
R Shiny and Leaflet # 3 - Demo of different types of base map tiles
library(shiny)
library(leaflet)
shinyServer(function(input, output) {
output$mymap <- renderLeaflet({
input$update # catching the action button event
isolate(leaflet() %>%
addProviderTiles(input$bmap))
})
})
library(shiny)
library(leaflet)
shinyUI(bootstrapPage(
leafletOutput("mymap"),
absolutePanel(top = 25, right = 20, width = 150, draggable = TRUE,
selectInput("bmap", "Base map tile provider", choices = c("Stamen.Toner",
"CartoDB.Positron",
"Esri.WorldImagery",
"MapQuestOpen.OSM",
"Stamen.Watercolor"),
selected = "CartoDB.Positron"),
actionButton("update", "Update Map!"))
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment