QGIS Date Management – Addressing Temporal Controller Skipping Yearly Data

dateqgistemporal-controller

I am working with a dataset which contains annual data for years in non-QGIS format i.e. 1951, 1955, etc from 1933 to 1955.

I have used " to_date( "year" , 'yyyy')" to convert this data into QGIS-friendly data, so as to be read and analysed using the Temporal Controller.

Each date is now rendered as e.g. 1955-01-01 – which works with the Temporal Controller.

I have then added a simple Date point layer for when creating heatmaps and gifs – expressed as format_date(@map_start_time, 'yyyy').

An issue I am facing, however, is that the 365.25 days by which a year is calculated eventually "overtakes", for want of a better phrase, the data I am working with.

As the image below shows, a point is eventually reached whereby a single year covers more than two years within the data. Here, for example, the map start date is 1937 but the data displayed – because, as far as I can tell, the date covers 1938-01-01 06:00:00 – is from 1938.

Has anyone else dealt with this / found a way to solve this when working with annual data on Temporal Controller?

enter image description here

Best Answer

Solution

The trick is to use a date somewhere in the middle of the year, not at the beginning of the year and to set an event duration of less then a year in the layer property settings.

How to make settings

  1. From your date, create a new field date2 by adding 6 months: "date" + to_interval ('6 months')

  2. In the Layer Properties / Temporal Tab set Field to date2 and for Event duration set something like 30 days.

  3. In the temporal controller interface, be sure to set Animation range from start to end of a year (like 1933-01-01 to 1955-12-31) and Step to 1 year.

Explanation

Now only if end of June is included in the current frame's range, the relevant features will show on the map. So even if the time range of the current frame "shifts" in a way that it overlaps the divide between two years (like 1937-01-01 06:00:00 to 1938-01-01 06:00:00), only 1937 will show up as 1937-06-30 is within this range, but not 1938-06-30. If you had 1938-01-01, however, both would show.

enter image description here