21

Using QGIS and other free tools, how can I use a Google Maps route to create a route animation in the style of the Indiana Jones movies (https://www.youtube.com/watch?v=5TY5Fp6O5iM)?

I have found two questions on this site (Show vehicle traveled route as animation and Interpolate points between coordinates for smooth animation in google maps or openmap) which deal with similar issues, but both of them are based on Google Maps or OpenLayers integrations and require coding.

I have found a very useful article on how to use the Time Manager QGIS plugin to map trajectories which fade out. In my case I would not need the path to fade over time, but that method could provide a useful basis for getting the laser effect that I want.

A further complication is that while I know the route that I want to animate, I do not have any actual data to use as inputs for the animation. I could get a route out of Google Maps, but that does not include timestamps so I'd either need a way to animate the steps in order, or otherwise add a timestamp somehow.

How can I put all of this together, or is there perhaps a more elegant way to achieve this effect using tools that are freely available?

  • Welcome to gis.stackexchange! Please note that a good question on this site is expected to show some degree of research on your part, i.e. what you have tried and - if applicable - code so far. For more info, you can check our faq. – underdark May 2 '16 at 18:27
  • Hi @underdark, I posted this as a Q&A question thinking that the answer provides the evidence of research. I understand that the question still needs to stand alone as a good question, so I've expanded it. Thanks for the excellent Time Manager plugin, which was an integral part of solving this problem! – rudivonstaden May 3 '16 at 4:47
  • 1
    This is very helpful, almost exactly what I am trying to achieve. However, is there any way to make the map pan to follow the route? I want to show the route of a proposed road, which will require moving the map to show enough detail at the required scale. I have spent an awful lot of time googling and I just can't work out how to do this final step. If you watch the Indiana Jones video you'll see that the map pans as well! – Rob Kemp May 3 '16 at 5:10
  • 1
    Sorry I missed that you answered yourself. I love the answer and thanks for expanding the question! – underdark May 3 '16 at 6:30
35

Step 1: Share your route in Google Maps

In Google Maps, create the route, then share it to get a link to the directions.

Share map link in Google Maps

Step 2: Convert the route to a GPX file

Using the handy convert feature at GPS Visualizer (http://www.gpsvisualizer.com/convert_input), paste the link you copied from Google Maps, select GPX as the output format and download the file.

Convert to GPX using GPS Visualizer

Step 3: Add timestamps to the route

Upload the GPX to GOTOES timestamps utility (http://gotoes.org/strava/Add_Timestamps_To_GPX.php), specifying start time, time zone and average speed. Download the resulting file.

Add timestamps

Step 4: Load the track waypoints in QGIS

Add the timestamped GPX file as a vector layer in QGIS. Select the track_points layer when prompted for which layer to load from the GPX file. This should load a breadcrumb trail of waypoints along the route.

You should also add a base layer to add context to your map. QuickMapServices is useful here (see Adding Basemaps from Google or Bing in QGIS?)

Step 5: Save as a Spatialite layer

You will not be able to use the GPX layer as is, because it is not editable. There also seems to be a bug which truncates the timestamps if you save as a Shapefile. Spatialite files seem to work well, though. Select the layer in the Layers panel, and choose 'Layer > Save as...' from the menu. Specify 'Spatialite' as the format, and make sure that 'Add saved file to map' is selected.

Step 6: Fix Symbology

Double-click on the layer in the layers panel to open the properties, and click on the Style tab. Click on the 'Simple marker' style, and choose an appropriate colour for your "laser"-styled route. Change the size to 1.5 (or your own preference). Set outline style to 'No Pen'.

Update symbology

Step 7: Add the Time Manager plugin to QGIS

If you haven't already done so, add the Time Manager plugin to QGIS. Go to 'Plugins > Manage and Install Plugins...', select the 'All' tab, and search for 'TimeManager' (one word). Make sure the check box next to the name is selected, and click on 'Install plugin'.

Step 8: Register the layer in Time Manager

You should now see a Time Manager panel under your map canvas. Click on the 'Settings' button, and then 'Add layer'. Specify the name of your route layer, choose the 'time' attribute for start time, and choose 'No end time...' for end time.

Add the layer in Time Manager

Step 9: Export video

Choose an appropriate time frame size for your data (each frame will represent this amount of time). Click the play button to test the settings. Click the 'Export Video' button to export (if you've played the animation, make sure you move the slider back to the start position first). If you're on Windows, you will only be able to export a series of images (at least as of version 2.2.4). That's fine, we can use another tool to combine them into a video.

Step 10: Compile into an animation

Copy the contents of the output folder, and paste into Windows Movie Maker (or any other preferred tool). Select all the images (click on one, and then Ctrl+A to select all), click on the Edit menu, and set the image display duration appropriately (around 0.1 seconds per frame). Use File > Save Movie to save in an appropriate format.

Export movie

The result should look something like this (converted to a GIF file afterwards):

Result

I don't have a good technique for following the line and panning the map itself. It might require making a new QGIS plugin or script, or possibly modifying the Time Manager plugin to center the canvas on the current point for each frame. You can approximate the effect in Windows Movie Maker by using the pan and zoom animations in the Animations menu. Other video software may have better functionality for following a moving element.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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