I am creating a Shiny application that creates a booklet map (rCharts) depending on which route you choose. Everything is visualized at first glance, but if you change the route number, an empty map will appear (not even a tile). This does not apply to the route number. For example, I can choose any route number for the successful completion of the first leg, while the second schedule, regardless of the route number, is empty.
Has anyone come across this before? Is there a workaround?
Here is a simple example.
ui.R:
library(shiny) library(rCharts) shinyUI(fluidPage( titlePanel("Responsive Leaflet Map using rCharts"), sidebarLayout( sidebarPanel( "", selectInput( 'route', 'Pick a bus route:', choices = as.character(c("232","229"), selectize = FALSE) ) ), mainPanel("", chartOutput('map', 'leaflet') ) ) ))
server.R:
library(shiny) library(rCharts) library(RJSONIO) library(rgdal) shinyServer(function(input, output) { output$map <- renderMap({ filename <- paste('json/',input$route,'.geojson',sep='') json <- fromJSON(file = filename) map3 <- Leaflet$new() map3$tileLayer(provide='Esri.WorldTopoMap') map3$setView(c(49.2494,-122.9797), zoom = 10) map3$set(dom = 'map') map3$fullScreen(TRUE) map3$geoJson( json, style = "#! {color: '#c93312'}!#") map3 }) })
Thanks so much for any help you can provide.
WITH
source share