Skip to content

Commit

Permalink
Loaded the stop data as a layer in the map. Increased the render size…
Browse files Browse the repository at this point in the history
… of the leaflet map in `server.R`.

Increased the render size of the `leaflet` map in the `ui` and added the dependency to `leaflet`.
  • Loading branch information
SimonGoring committed Apr 19, 2017
1 parent a2ac036 commit 6aa1e83
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
12 changes: 9 additions & 3 deletions BusMap/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,20 @@

library(shiny)
library(leaflet)
library(dplyr)

all_stops <- readRDS('../data/output/all_stops.RDS')
stations <- all_stops %>% filter(grepl(" STN ", stop))

# Define server logic required to draw a histogram
shinyServer(function(input, output) {

output$vanMap <- renderLeaflet({
map <- leaflet(width = 400, height = 400) %>% addTiles %>%
map <- leaflet(width = 400, height = 800) %>% addTiles %>%
setView(lng = -122.8,
lat = 49.2,
zoom = 11)
zoom = 11) %>%
addCircles(lat = stations$latitude,
lng = stations$longitude)
})
})
4 changes: 2 additions & 2 deletions BusMap/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
# http://shiny.rstudio.com/
#

library(leaflet)
library(shiny)

# Define UI for application that draws a histogram
Expand All @@ -32,7 +32,7 @@ shinyUI(fluidPage(

# Show a plot of the generated distribution
mainPanel(
leafletOutput("vanMap")
leafletOutput("vanMap", height = 800)
)
)
))
Binary file modified data/output/all_stops.RDS
Binary file not shown.
1 change: 1 addition & 0 deletions vignettes/api_test.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ get_stops <- function(x) {
return(stop_locs)
}
all_stops <- centerpoints %>%
by_row(get_stops) %>%
select(.out) %>%
Expand Down

0 comments on commit 6aa1e83

Please sign in to comment.