1

I have to animate a map of Europe (31 countries) which contains three separate vector layers:

The first layer is a simple map (with just the political boundaries) of Europe with 31 countries (each country being a distinct feature). This is a colour-coded map with 4 shades of gray, depending on how much energy a country can store during an hour (dark gray indicating the highest amount of stored energy, white the lowest).

The second layer is a collection of 31 circles (one over every country) with the size of each circle being proportional to the amount of energy produced during an hour. Each circle is a separate feature.

The third layer consists of transmission lines drawn between the circles. The width of each line indicates the amount of energy it transmits during an hour. There are 50+ lines in this layer and each line is a distinct feature.

Hence on a given map, these 3 layers (the circle layer superimposed on the storage layer, and the line layer superimposed on the circle layer) represent one picture of the energy stored, produced and transmitted in a particular hourly time-step. Using MATLAB, I can generate these layers for successive time-steps and I would like to animate those pictures for a period of 2 days (hence 48 pictures in total). Can you please guide me as to how this can be done most efficiently? Should I merge the three types of vector layers into one layer, e.g., for the first hour (and append the first time-stamp to them), then do the same for the next three layers for the second hour (and append the second time-stamp), and so on, and then finally merge all the 48 pictures together? Could there be an easier and less time-consuming way to animate those pictures?

I'm sorry if this is a basic question but this is the first time I am using QGIS Time Manager.

8
  • Please clarify, can you produce needed pictures with MATLAB? If you can - do it and use ffmpeg to convert images into video. Aug 1, 2013 at 10:16
  • No, not really. I can create these layers as shapefiles in MATLAB but I have to bring them into QGIS because QGIS is far more efficient than MATLAB when it comes to representing shapefiles as pictures.
    – Usman
    Aug 1, 2013 at 10:19
  • Using Matlab, you should export three Shapefiles. Every feature in those Shapefiles which has to be animated should have a timestamp. Don't create separate Shapefiles for different timestamps! That's not how TimeManager is supposed to work.
    – underdark
    Aug 1, 2013 at 11:07
  • Yes, that's the problem. Using MATLAB, I can export 3 separate shapefiles (stored energy, generated energy, transmitted energy) for a particular time-step, e.g. the first hour of the day. I can merge them into one vector layer in QGIS; but then, that layer/shapefile will only represent a picture for the first hour of the day. I will have to create another picture (after merging the three layers again) for the next time-step, the second hour of the day, and so on for 48 hours. In the end, I'll have 48 layers/shapefiles, each with a different time-stamp. Continued...
    – Usman
    Aug 1, 2013 at 11:18
  • ... So I wanted to know if finally merging all the 48 (already merged) shapefiles into one big shapefile, and then selectively appending time-stamps sequentially to the features is a possible solution. Is there also any other method which could be more efficient?
    – Usman
    Aug 1, 2013 at 11:21

1 Answer 1

2

For each layer you want to animate you need to have a field with the stored time stamps. Time formats:

YYYY-MM-DD HH:MM:SS.ssssss 
YYYY-MM-DD HH:MM:SS 
YYYY-MM-DD HH:MM 
YYYY-MM-DD 
YYYY/MM/DD HH:MM:SS

Load and prepare your layers in QGIS, open Time Manager plugin, hit 'Settings' button and add the layers you want to animate: enter image description here

Adjust other animation settings and hit "Export video" button. It will generate a bunch of pictures. Then use ffmpeg tools in console to create video itself. Here is example command that creates .flv file from .png files:

ffmpeg -r 1/1 -i frame%03d.PNG -vcodec yuv420p -video_size 1126x560 output.flv

P.S. Time manager has sufficient help documentation ;-)

9
  • Thank you. So, I don't need to append a time-stamp to every feature (country, circle of line) of every layer, then?
    – Usman
    Aug 1, 2013 at 10:43
  • No, only those to be animated. Aug 1, 2013 at 10:48
  • I see. Actually, since all of them have to be animated, I guess I'll have to do it for every one of them. Thank you. I'll try it out and see if it solves my problem.
    – Usman
    Aug 1, 2013 at 10:57
  • @Usman, no, 'animation' means change in representation based in a time field. So the layers that don't have time stamps, but are displayed in canvas will be shown on exported images as is. Just don't hesitate to try it to see what you get with different settings. Aug 1, 2013 at 11:01
  • Actually, the problem is that the colours (shades of gray) of some, or even all, of the countries will change on an hourly basis (depending on whether there are any changes in the stored energies). The same is true in the case of the lines (changing widths) and the circles (changing sizes). So, the video will potentially have all of the attributes (different kinds of energies) of all the features of all the layers fluctuating on an hourly basis. The only thing which will remain constant is the political boundaries of the countries.
    – Usman
    Aug 1, 2013 at 11:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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