Web boxes with dynamic Weather Forecast data from DMI

In this example we will look into how to bringe live, dynamic weather forecasts into your dashboards. We will be using Web Box objects for that.

The example is based on weather data supplied by the Danish Meteorological Institute (DMI, http://dmi.dk), thus the dashboard has been designed with a Danish interface. Still, the principles used should be clear and useful, even to a non Danish speaking audience.

Finding the right URLs

First, you need to make sure that a URL to a web page is compliant with embedding in an iFrame. For instance, the normal URL to DMI, http://dmi.dk, does not work. If you try to insert it into a Web Box and click the Apply (Anvend) button, you will get a warning that it will not work and that web box will remain empty.

mceclip0.png

So I did a little research on the Internet and found that you could retrieve DMI weather forecasts with these URLs, that all comply with iFrame embedding:

Notice that the "by=9000" in these examples specifies the zip code 9000, which is the zip code of Aalborg - the location of TARGIT HQ.

If you just insert these URLs in three separate Web Box objects, you will get something like this:

mceclip1.png

Of course, you can replace the zip code with the zip code of your own home town to get your own, local weather forecasts.

Every time the dashboard is loaded or refreshed, the web box content is also reloaded. So if a new weather forecast has become available in the meantime, it will automatically show.

Make the URLs dynamic

Now, the next step is not necessarily something you need to do. If your requirement is to show weather forecasts for just a single location, then you just need to set the correct zip code in the above URLs.

However, I took it a step further. I Googled, found and downloaded a CSV file with information about Danish zip codes, including their location names. I also added this CSV file to Data Discovery and ended up with something like this:

mceclip2.png

Now I can actually use this table as a slicer - applying the zip code as a drill down filter on my web boxes.

In my web boxes, all three of them, I replaced the static zip code with dynamic content:

2021-09-15_11-52-57.png

mceclip3.png

In my final dasboard I filtered my locations to about a dozen locations, and furthermore added a header and a map to the dashboard.

Without any selected location (shows the Last/Sidste member, Aalborg):

mceclip4.png

Filtered on 'S√łnderborg' from the table:

mceclip5.png

Filtered on 'Viborg' from the map:

mceclip6.png

 

Was this article helpful?
1 out of 1 found this helpful

Comments

0 comments

Please sign in to leave a comment.