Friday, 10 February 2017

expression - How to create a 'dummy' DATETIME field for QGIS timemanager?


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?



Answer



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.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...