Nice Animations with Time Manager’s Offset Feature

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.
Three layers with different styles will make the animation more interesting.

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.

About these ads
23 comments
  1. dassouki said:

    Awesome stuff, I have a question for you:

    How would you change anything if let’s say you have fixed locations (city reduced to a single point) and you’re trying to look at the amount of tweets per time interval per city. You layout the map of Europe and reduce the major cities to nodes. Then I assume you have to normalize the data somehow. Finally at each flash, the circles should be dimensioned based on the amount of tweets done at that time interval for that location

    • underdark said:

      Thanks Dassouki! My first idea would be to have one point per city and time interval. The number of tweets could be used as a size scale field for the city symbol. I’m not sure if normalization is really necessary. I’d give it a try without first. Great idea by the way! Are you working on something like that?

      • Dassouki said:

        Yes I am, after your reading your blog post, I thought it would be a great idea to do it for my traffic counts. I just finished binning 50 sites at 30 minute counts for the last year. My GIS.se question, I wanted to add ambient time of day to the raster, that way when you see lots of lights from traffic flashing up you can tell what type of light there was outside, especially since the winter sun is around 10 hours versus summer is around 18

  2. MapserverSA said:

    Very cool stuff, thank you.I am testing it as a visualization / presentation tool showing infrastructure maintenance schedules. My time data is over 3 years so trying to get the right interval settings for the best impact – any suggestions?

    • underdark said:

      That would depend on how long a single maintenance task takes and how many of them you have within this 3 year period. Also, what kind of effect do you want to achieve? Should it look like there is something going on all of the time? I find that it usually takes quite a while to find a combination that works for me.

      • MapserverSA said:

        The Maintenance Task doesn’t have a duration. Each asset is flagged to be due for maintenance on x date. Some require maintenance every year, some only once every 3 years – my PostGIS database sorts out the Maintenance Schedule. I have managed to get each asset to appear (as a dot) when it is due for Maintenance and the resultant clip runs for about 1 minute. I have tried applying the same technique as your Twitter example but I don’t get the flashes working. When you set the offset in seconds is that the offset in terms of the clip timeline or the data timeline? I will play with it some more but some guidance would be appreciated

      • underdark said:

        The offset is meant to be on the date timeline and it has to be specified in seconds. The offset will depend on your time step size. (In the example I had a time step size of 10 seconds and offsets of -10 and -20.) Are you showing one day per time step now?

      • MapserverSA said:

        I am trying different scenarios using various steps sizes and offsets. I am going to apply it to the phased construction of a water reticulation scheme so that the video will show the planned schedule for pipes, dams and boreholes. I think it will be very useful when presenting our results to non-technically minded stakeholders.

  3. ericcompas said:

    Thanks for providing details (and for building such a useful tool)! I used Time Manager to visualize recall petitions in Wisconsin, USA: http://wp.me/phFpT-3w

  4. Niknok said:

    Sorry for being a bit thick but I’m trying to animate daily events from a 10-year data set (of 25k records) but couldn’t get it done properly. My offset is -86400 (1 day).

    What am I supposed to adjust to view this properly?

    • Niknok said:

      Ignore my last comment. It was stupid of me not to push the “play” button.

  5. gavinmc said:

    Hi,
    I am using TimeManager to animate some arrival and departure events over a 24hour period. I checked the box to display the time on the map but it is appearing behind the QGIS copyright information in the bottom right corner. Any ideas how to get around this?
    Great tool by the way!!

    • gavinmc said:

      Ignore my question…I found the answer!

  6. Yassine el kodadi geomarketing said:

    I have a table with one location for each day, i would like to show data by day, first image will show the location of a user on 2012-07-01 , second image for the location of a user on 2012-07-02 … what should i put on the offset and on the time framesize thank you underdark

    • For this use case you don’t need any offset. You can leave the field empty.

      • Yassine el kodadi geomarketing said:

        when i click on the play button i can’t see my points showing up on the map, it’s all blank from the beginning to the end. But i can see than the dates are those that i have on the csv file ( from 2012-04-01 to 2012-04-01 ) .
        Time framesize 1 day. Offset = 0. show frame for 200 milliseconds. May be i am doing something wrong ???

      • All the settings sounds reasonable. If you turn TimeManager off, do you see all the points?

  7. Antonin said:

    Is there a way to have a bigger time stamp on the map? I’m generating a video to be presented on a beamer, and this is too small.
    Thanks!

Follow

Get every new post delivered to your Inbox.

Join 2,955 other followers

%d bloggers like this: