Search code examples
rshinydarksky

How to embed weather API into shinydashboards


I am creating shiny dashboard that will have various information. One of the things that I am trying to implement is to have a section in the app for weather. I am learning shiny dashboard on the go. This in fact is my first shiny app. So in order to learn this I googled how to get weather into shiny dashboards. I came upon on a similar question here on stack overflow here and found out how a guy got boston weather into his app. I was able to mimic his code and in my shiny dashboard get the weather for boston. However I want the weather for Vienna Austria. so I basically took his code:

                tabName = "dashboard",
                fluidRow(
                    tags$iframe(
                        seamless = "seamless", 
                        src = "https://forecast.io/embed/#lat=42.3583&lon=-71.0603&name=Downtown Boston", 
                        height = 800, width = 1400
                    )
                )
            )

and tried to change the latitude and longitude coordinates and the name. Here is the code:

      fluidRow(
        tags$iframe(
          seamless = "seamless",
          src = "https://forecast.io/embed/#48.2205998&lon=16.2399771&name=Vienna",
          height = 800,
          width = 1400
        )
      )
    )

This of course didn't work and I got back as a result invalid location. I tried to go to the dark sky website and see if I need to register with them to get a personal key and other information but they said they are not accepting new registrations. I have tried googling other ways to put in weather but I cant find much on how to do this.


Solution

  • You made a mistake with the format:

    https://forecast.io/embed/#lat=48.2205998&lon=16.2399771&name=Vienna