Skip to content

Instantly share code, notes, and snippets.

@aagarw30
Created July 27, 2016 14:53
Show Gist options
  • Save aagarw30/dec12dce085227b01d19c56b1122981e to your computer and use it in GitHub Desktop.
Save aagarw30/dec12dce085227b01d19c56b1122981e to your computer and use it in GitHub Desktop.
Leaflet - map the data - reproducible
library(shiny)
library(leaflet)
library(RCurl)
shinyServer(function(input, output) {
URL <- getURL("https://commondatastorage.googleapis.com/ckannet-storage/2012-07-09T214020/global_airports.csv")
mydata <- read.csv(text = URL)
output$mymap <- renderLeaflet({
leaflet(mydata) %>%
addProviderTiles("Esri.WorldTopoMap") %>%
addMarkers() %>%
setView(lng = -5, lat =5 , zoom=2) # centered at the lat, lon defined and zoomed
})
})
library(shiny)
library(leaflet)
shinyUI(bootstrapPage(
# tags$style(type = "text/css", "html, body {width:100%;height:200%}"),
leafletOutput("mymap")
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment