Animating Time Series Data (QGIS3)

Time is an important component of many spatial datasets. Along with location information, time providers another dimension for analysis and visualization of data. If you are working with dataset that contains timestamps or have observations recorded at multiple time-steps, you can easily visualize it using the Temporal controler. Temporal controler allows you to view and export “slices” of data between certain time intervals that can be combined into animations.


Temporal Controller is available from QGIS 3.14 onwards. For older versions of QGIS, the Time Manager plugin provides a similar functionality.

Panoramica del procedimento

Prendere un layer di punti rappresentanti una serie di incidenti relativi alla pirateria marittima, creare una visualizzazione di tipo Heatmap e produrre un’animazione di come le zone calde della pirateria siano cambiate negli ultimi 2 decenni.

Altre abilità da imparare

  • Utilizzare una rappresentazione tipo Heatmap per una veloce visualizzazione della densità di gruppi di punti

  • Creazione e utilizzo di proiezioni cartografiche personalizzate

Ottenere i dati

Il sito National Geospatial-Intelligence Agency’s Maritime Safety Information portal mette a disposizione gli shapefile di tutti gli incidenti di pirateria marittima dalla maschera Anti-shipping Activity Messages <> scaricate l” Arc Shape file <> nella versione version presente nel database.

Il sito Natural Earth mette a disposizione numerosi layers vettoriali. Scaricate il file zippato 10m Physical Vectors - Land contenente poligoni del suolo.

Per comodità, potete scaricare direttamente una copia dei layer cui sopra dai seguenti link:



  1. In the QGIS Browser Panel, locate the directory where you saved your downloaded data. Expand the and select the ne_10m_land.shp layer. Drag the layer to the canvas. Next, locate the file. Expand it and select the asam_data_download/ASAM_events.shp layer and drag it on to the canvas.

  1. Once the layer is loaded, you can see the individual points representing incidents of piracy locations. There are thousands of incidents and it is difficult to determine with more piracy. Rather than individual points, a better way to visualize this data is through a heatmap. Select the ASAM_events layers and click the Open the layer Styling Panel button in the Layers panel. Click the Single symbol drop-down.

  1. In the renderer selection drop-down, select Heatmap renderer. Next, select the Viridis color ramp from the Color ramp selector.

  1. Adjust the Radius value to 5.0. At the bottom, expand the Layer Rendering section and adjust the Opacity to 75.0%. This gives a nice visual effect of the hotspots with the land layer below.

  1. Now let’s animate this data to show the yearly map of piracy incidents. Right click on ASAM_event layer, and choose Properties.

  1. In the Layer properties dialog box, select the Temporal tab and enable it by clicking the checkbox..

  1. The source data contains an attribute dateofocc - representing the date on which the incident took place. This is the field that will be used to determine the points that are rendered for each time period. Select Single Field with Data/Time in Configuration Drop down menu, dateofocc as Field.

  1. Now a clock symbol will appear next to the layer name. Click on the Temporal Control Panel (Clock icon) from Map Navigation Toolbar.

  1. Click on the Animated Temporal Navigation (play icon) to activate the animation controls. Click the Set to Full Range (refresh icon) next to Range to automatically set the time range to the match the dataset.

  1. Now you are ready to preview the animation. Set the Step as 1 Year then click the Play button to start the animation.



If the animation is too fast, you can adjust the frame rate by clicking Temporal Settings (yellow gear icon) at top-right corner of Temporal Controller panel. Decreasing the the frame rate (frames per second) will slow down the animation.

  1. It would be helpful to also display a label showing the current time frame on the map. We can do that using the built in Title decoration. Go to View ‣ Decorations ‣ Title Label.

  1. Click the checkbox to enable it and click Insert an Expression button and enter the following expression to display the year. Here the variable @map_start_time contains the timestamp of the current time slice being displayed. So we can use that timestamp and format it to display year of occurrence. See the QGIS Documentation for details on various supported formatting options for the timestamp.

format_date(@map_start_time, 'yyyy')
  1. Select font size as 25, set background bar colour as White and set the transparency to 50%. In Placement choose Bottom Right. Now click Ok.

  1. Once the parameters are set accordingly, the year will display as shown. To export these as images and convert them as GIF select the Export Animation (save icon) in the Temporal control window.

  1. Click on the ... Output directory to choose the directory at which the images will be saved.

  1. Under the Extent select the Calculate from Layer ‣ ne_10_land layer. Click Save.

  1. Once the export finishes, you will see PNG images for each year (total 18 images) in the output directory.

  1. Now let’s create an animated GIF from these images. There are many options for creating animations from individual image frames. I like ezgif for an easy and online tool. Visit the site and click Choose Files and select all the .png files. Once selected, click the Upload and make a GIF! button. Once created, you can download the GIF using the Save button.

comments powered by Disqus