Animating hurricanes using QGIS

This Video shows 160 years of Hurricanes.

This was rendered using QGIS; the final video was stiched using ffmpeg.

The hurricane data was from NASA. The rest was from Natural Earth.

How it was done

To get the globe, I had to use a custom CRS for on-the-fly projection, an Ortho projection centered on (90W,44N). I created a custom CRS with the following proj4 settings:-

+proj=ortho +lat_0=44.0 +lon_0=-90.0 +x_0=0 +y_0=0

If you try to render a whole-world dataset using that projection, you get horrible artifacts. In some projections, this is caused by features crossing the anti-meridian. In the case of ortho, it's caused by features crossing the edge of the visible hemisphere.

artifacts when using an ortho projection...

artifacts when using an ortho projection...

To get around this, I used the Clip to Hemisphere plugin. This plugin lets you set a vector layer, a latitude and longitude, and clips the vector layer to the visible hemisphere.

I ran this against several layers, namely

  • the hurricane lines layer
  • the 15 degree graticule layer from Natural Earth
  • the 10m country polygons from Natural Earth
  • the WGS84 bounding box layer from Natural Earth

the end result is shown below (in WGS84). I used a Draw effect (Outer Glow) on the clipped WGS84 bounding box to give the 'atmosphere glow' effect.

the parts of the earth visible in the ortho projection

the parts of the earth visible in the ortho projection

and this is what it looks like using the custom CRS:-

 

Preparing for Time Manager

The Time Manager plugin allows you to export multiple renderings, based on a time value. If you have a time-based field on each feature, it will render only those features within a specific time interval.

The original dataset contained a field called season, giving the year (1845, 1846, ... 2015). I added a field called season2, which was season minus 1845. So each hurricane trail was given a value according to year, starting at 0.

I then told Time Manager to use this field. If time manager sees the field is a number, it assumes it's a unix time stamp (seconds since midnight on 1st Jan 1970). By setting the frame interval to 1 second, each successive frame showed one year's worth of hurricanes.

Rendering the Video using ffmpeg

I tend to use ffmpeg for video stitching, as it allows good control of frame rates, resolution and quality. The tip I have is to get rid of all the .pngw world files that Time Manager generates, as they get picked up by ffmpeg and make it fall over.