Ошибка в отправке: отсутствует аргумент "map", по умолчанию нет - PullRequest
0 голосов
/ 20 февраля 2019

Я хочу сделать блестящее приложение, в котором я могу выбирать различные слои для визуализации из выпадающего списка выбора.Я попробовал приведенный ниже код, но все же я не уверен, почему я получаю ошибку?Любая помощь приветствуется.Предполагается иметь разные хороплеты.

ui <- fluidPage(
  titlePanel("The Montreal Sustainability Dashboard"),

  sidebarLayout(position = "right",
                sidebarPanel(
                  h2("Mobility and Transportation"), 
                  navlistPanel(
                    "Result",
                    tabPanel("GHG"),
                    tabPanel("Calories")
                  ),
                  selectInput("select_1", label = h5("Choose Base Map"), 
                              choices = c("OSM", "Toner", "Toner Lite"), 
                              selected = "OSM"
                              ),
                  selectInput("select_2", 
                              label = h5("Choose Mode of Transport"), 
                              choices = c("Cycling","Walking","Drive", "Transit"), 
                              selected = "Cycling"
                              ),

                  img(src = "MSSI.png", height = 100, width = 500)
                ),

#-------------------------------------------------------------------------------------------------------------
#define main visualisation part

mainPanel(
        p("Sustainability and resiliency issues are increasingly at the forefront of discussions and decisions at all levels of municipal governance and decision-making. 
        Our team has risen to the challenge by creating the Montreal Sustainability Dashboard, an inclusive and interactive visual platform designed to track, understand and respond to how urban environment impacts upon sustainability. 
        The dashboard responds to the motivation to develop a tool that is democratic, open, relevant, and accessible to the Montreal community, incorporating the experiences of Montrealers across socioeconomic statuses to include and represent all of its inhabitants and institutions. The dashboard will increase awareness surrounding issues of sustainability and resilience for citizens and organizations in Montreal, incentivize behaviour change, and provide the technical tools and platform to achieve long-term sustainability goals. The Montreal Sustainability Dashboard is funded by the McGill Sustainability Systems Initiative (MSSI). For more info visit",
        a("MSSI Homepage.", href = "https://www.mcgill.ca/mssi/"),

        plotOutput("map1",width="100%", height=800)
                  ))))

#--------------------------------------------------------------------------------------------------------------
# Define server logic
server <- function(input, output,session){
  output$map1 <- renderPlot({
    data1<- switch(input$select_2, 
                  "Cycling"=addPolygons(data = CT, weight = 1, fillColor = ~ pal(FM_Bicyc), color = ~pal(FM_Bicyc), fillOpacity = 0.),   
                  "Walking"=addPolygons(data = CT, weight = 1, fillColor = ~ pal(FM_Bicyc), color = ~pal(FM_Bicyc), fillOpacity = 0.), 
                  "Drive"=addPolygons(data = CT, weight = 1, fillColor = ~ pal(FM_Bicyc), color = ~pal(FM_Bicyc), fillOpacity = 0.), 
                  "Transit"=addPolygons(data = CT, weight = 1, fillColor = ~ pal(FM_Bicyc), color = ~pal(FM_Bicyc), fillOpacity = 0.)
                  )
                 # width = "auto", height = "auto"
                      # height = function() {
                      session$clientData$output_map1_width
    #quartz(title="density", height = 400, width = 400)


                     map1

  }) 

}


   # leaflet(CT) %>% 
      #setView(lng = -73.5673 , lat = 45.5017, zoom = 10) %>% 
      #addWMSTiles(
       #"https://maps.geogratis.gc.ca/wms/elevation_en?",
       #layers = "cdem.color-shaded-relief",
       #options = WMSTileOptions(format = "image/png", transparent = TRUE),
       # attribution = "CDEM (Canadian Digital Elevation Model)")%>%
      #addTiles() %>% addProviderTiles(providers$Stamen.Toner)
      #addPolygons(data = CT, weight = 1, fillColor = ~ pal(FM_Bicyc), color = ~pal(FM_Bicyc), fillOpacity = 0.)   
      #addPolygons(data = data_subset, weight = 1,  color = "blue", fillOpacity = 0.) #%>%    
      #addPolylines(data = piste, weight = 3, fillOpacity = 1) %>%
      #addLegend(pal=pal, values = ~FM_Bicyc, title="Cycling",group='circles1', position='topright') %>%
      #addLegend(pal=pal, values = ~FM_Bicyc, title="Piste", group='circles2', position='topright') %>%
      #addLayersControl(baseGroups = c('circles1', 'circles2'))


# Run the app ----
shinyApp(ui = ui, server = server, options = list(height = 1400, width=2800))


Теперь я использовал только select_2 в качестве входных данных, но позже я хочу использовать другие входные данные для каждого типа данных.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...