We have several 'time-aware' datasets, but the dates are stored as YEAR (2017), SCHOOLYEAR (20172018), etc. rather than a true DATETIME value.

In order to animate these datasets, is it possible to create a dummy DATETIME value using a virtual field in QGIS?

I've tried so far to create a virtual field using the following expression:

to_datetime(LEFT("SCHOOLYEAR",4) || '-' || '10' || '-' || '01')

Which looks correct:

enter image description here

...though in the attribute table there is an added T - which might be acceptable based on the formats I get in the error below...

enter image description here

But when I apply the layer to the timemanager, I get this error:

enter image description here

Any thoughts on what format / expression I should be using given my inputs?

  • Without the to_datetime(): If I use a datetime field type for the virtual field, I get the same error as above. If I use a char field, I get an error that the virtual field doesn't exist... – DPSSpatial Nov 28 '17 at 22:39
  • @Kazuhito there is no option for STRING outright, just the three text type fields... – DPSSpatial Nov 28 '17 at 22:44
  • @Kazuhito yes, doesn't seem to be working... – DPSSpatial Nov 28 '17 at 22:51
  • ...it is strange and I cannot reproduce this error. A text field like 2009-10-01 works just fine for me. – Kazuhito Nov 29 '17 at 9:48

It took me some time to reproduce the error, sorry...

enter image description here

The error (upper right) came from wrong choice of the Start time(hence also End time). in the Time manager's Settings. We have to select DATETIME field. It can be either Date, Datetime, Text(string) types (as far as the format is acceptable to Time manager).

enter image description here

Your original data as shown in your question should work fine, too.

  • Unfortunately I'm doing everything correct so far - not sure why I'm getting this error! – DPSSpatial Nov 29 '17 at 21:21
  • @DPSSpatial Yes, very much weird... – Kazuhito Nov 29 '17 at 21:24
  • Still didn't figure this out, but accepting this as the answer. – DPSSpatial May 3 '18 at 16:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.