Creating a map panning video with the QGIS 3D map view

Data Visualization

QGIS 3.X includes a 3D map view (View -> New 3D Map View) which was developed by Lutra Consulting. The functionality to create flyover videos is integrated in this view. This can also be used to create panning and zooming videos of conventional maps. In this article I explain how I made such a video.

I realized this project in the context of my monthly mapping of the Critical Mass Essen bicycle tour. At critical mass events large numbers of bicyclist drive through a city as a convoy in a random fashion. This serves to create awareness for cycling as an environmental friendly, healthy, and economic mode of transport.

The window below shows the 2-minute mp4 video I made, embedded via my Youtube-channel.

This is how I created the video. First, I logged the tour with the open source GPSLogger app as a KML file. I loaded the file into QGIS, and and manually removed the worst GPS jitters, to get a smooth curved line representing the tour.

I chose a light orange tone for the line, start and end points, and labels. As a labeling font I used DIN Schablonierschrift, a font that has it’s background in stencil writing often seen on German streets.

Using the QGIS QuickMapServices plugin, I set the Bing Aerial map as a background, which I turned to grayscale in the layer settings. I reduced the brightness and contrast to get a background where the light orange line would be better visible.

The elaborate camera movements needed some structure to be set up. Thus I created a point layer with helping points. I measured the distances between the points using the measure tool, and included the accumulated distance from the first point as an attribute. The time at which each point should be shown is then calculated as timePoint = timeOffset + distancePoint * totalTime/totalDistance.

In the 3D map view a press on the „play“ icon opens the animation/video timeline below the view. The current camera point of view can be added as a keyframe to the animation with a click on the „+“ icon. Thus I could set up the animation keyframes manually quite fast with the previously specified points and times. Enabling „Show camera’s view center“ in the 3D map view settings allows to cleanly focus on given points. The camera can not just be panned and zoomed, but also be tilted and turned but I intentionally did not use these possibilites.

There are a few pitfalls when creating animations in the 3D view. I constantly kept overwriting keyframes. It is necessary to reset the keyframe to <none> after having created a new keyframes, otherwise the keyframe is further being edited through the mouse movements.

I had some problems with panning movements done in rough steps (visible in mp4, not in gifs). In such cases the panning movements were much smoother when I changed the zoom level of a point, ran the animation and then set the zoom level back.

Also there were some glitches visible as tiles were reloaded during panning. It turns out that the settings for map tile resolution, max screen error, and max. ground error have a big impact on how tiles are loaded. In my case adjusting the tile resolution to a large 2048 px resolved all visible tile glitches.

When I was satisfied with the created animation, I recorded the video from the screen using the open source software shareX. With this tool it is possible to cleanly select the 3D view window with a single click and record the video in mp4 format. The recorded video is slightly more choppy then the animation visible in QGIS. In QGIS 3.6 it is apparently also possible to directly export animation frames from the 3D viewer.

As a final step, I used the open source video editing software Shotcut to add the white caption in the upper left into the mp4 file. I also used the program to export the gif extract shown above. The file size was reduced with the online gif optimizer Ezgif.