May 13th, 2021
This is Hans, a software engineer at Datawrapper, and the person who works a lot on our locator map feature. For this week’s edition of the Weekly Chart, I created an automatically updating weather map that shows the latest weather predictions.
This summer, I often check the upcoming weather using the service of the German Meteorological Service (DWD) to plan trips. I noticed that the website has a open data portal which also offers weather predictions for the upcoming days. This encouraged me to make my own weather map using a Datawrapper locator map. No matter when you’re reading this, here is the weather in Germany for tomorrow:
It shows similar information as the German weather map from DWD’s website:
I started recreating the map (with fewer locations) in the locator map editor. Conveniently, locator maps offer a variety of weather icons out of the box. I also gave the temperature markers colors that indicate the temperature. To show the date of the map, I used a marker with a text box.
But this is not a normal locator map. Creating a weather map for a single day would be pointless – it would be outdated by the time the blog post would have been published. So I wrote a script (scraper) that extracts the most recent weather data from the DWD data portal. You can find it on GitHub and adapt it if you like. There are also many weather stations available outside of Germany.
I then parsed that data to make it work with locator maps and displayed it on the map. Here’s how:
Using an external source for a locator map is currently not officially supported, so the steps are a little complicated – but doable. To create a map that uses the most recent weather predictions, you will
a) probably have to write a script that extracts data from a website or downloads it from somewhere, and you will
b) need to write a script that parses your data in a way that it works with locator maps.
You’ll need basic programming skills to do this. Here are the steps in detail:
We’re thinking of making these steps more convenient for you, so if you find it useful to use external data for your locator map, let us know – either below in the comments or at firstname.lastname@example.org. See you next week with a Weekly Chart from our support engineer Aya!