You probably know this video from my previous post “Tweets to QGIS”. Today, I want to show you how it is done.
After importing the Twitter JSON file, I saved it as a Shapefile.
Every point in the Shapefile contains the timestamp of the tweet. Additionally, I added a second field called “forever” which will allow me to configure Time Manager to show features permanently.
A "forever" field will help with showing features permanently.
To create the flash effect you see in the video, we load the tweet Shapefile three times. Every layer gets a different role and style in the final animation:
- Layer “start_flash” is a medium sized dot that marks the appearance of a new tweet.
- Layer “big_flash” is a bigger dot of the same color which will appear after “start_flash”.
- Layer “permanent” is a small dot that will be visible even after the flash vanishes.
styling the tweet layers
We’ll plan the final animation with a time step size of 10 seconds. That means that every animation frame will cover a real-world timespan of 10 seconds.
We configure Time Manager by adding all three tweet layers:
Layer “start_flash” starts at the orginal time t. Layer “big_flash” gets an offset of -10 seconds, which means that it will display ten seconds after time t. Layer “permanent” gets an offset of -20 seconds and ends at time forever.
Layers can be timed using the "offset" feature.
Finally – in Time Manager dock – we can start the animation with a time step size of 10 seconds:
Use a time step size of 10 seconds so it fits to the offset values we specified earlier.
Besides watching the animation inside QGIS, Time Manager also enables you to export the animation to an image series using “Export Video” button. Actual video export is not implemented yet, but you can use mencoder (Windows users can download it from Gianluigi Tiesi’s site) on the resulting image series to create a video file:
mencoder "mf://*.PNG" -mf fps=10 -o output.avi -ovc lavc -lavcopts vcodec=mpeg4
Time offsets are a new feature in version 0.4 of Time Manager. You can get it directly from the project SVN and soon from the official QGIS repo.