OpenStreetMap logo OpenStreetMap

Thumbnail of the video at commons

Link to the Time Lapse Video of Amaravati (2015-2025)

Time lapse video of OSM has been of interest to me for more than 10 years. I learned to use QGIS in 2015 and made a physical map of Andhra Pradesh in my first attempt. Learning QGIS with its myriad menus and concepts of GIS was daunting to venture further during my infrequent attempts. Finally I made my first time lapse video after 10 years. I found OSM contributor radiotrefoil's diary entry on the subject posted about an year back very helpful. Still I had to struggle to make a good video for OSM edits for Amaravati, the green field capital of bifurcated Andhra Pradesh, a province of India. This is an attempt to document my learnings and make it easier for others.

Choosing an area of interest and fetching data

OSM object model is based on few simple graphical primitives and several tags to capture the inherent complexity of reflecting the physical word as a digital map. To really prepare a good quality map, map needs to be separated into physical features like natural, buildings, highways etc and also based on their basic OSM type like node, way, and relation. Depending on the extent of mapping activity and duration, separate files for each feature and its OSM type will be needed. Processing time could increase if the files are large. So it is better to focus on an area of appropriate size. For barely mapped areas, a few hundred square kilometres and for heavily mapped areas, 20-50 square kilometres could be considered. To aim at generating 2-3 minute video, a time frame of 10-15 years of data could be considered. The area could be chosen so that it consists of urban and rural parts, as it can help in understanding the mapping activity from the video. For my project, I considered Amaravati seed capital area and bit of nearby urban areas, as the capital's time line of construction, overlapped with the time line of OSM edit history of my interest.

It is a good practice to use the closest relation for the area of interest to get the bounding box coordinates. For my project, I used Amaravati city relation. Check the object information to get bounding box of it after downloading in JOSM using CTRL+I. I got the following details

Bounding box: 16.4137571, 80.6054567, 16.5742783, 80.4074471
Center of bounding box: 16.4940177, 80.5064519
Area: 211.7 km²

Determine a 4 decimal digit precision of the bounding box by truncating South and West border values and rounding up the North and East border values.

16.4137, 80.6055, 16.5743, 80.4074

These are to be ordered as follows when querying “Ohsome.org”

West, South, East, North
80.4074 16.4137 80.6055 16.5743

“Ohsome.org” is a great site to get historical map data for an area of interest through APIs. Here is an example api url for railway feature of type way, which could be repeated for other OSM object types like node or relation if appropriate. It is better to get the data for each OSM object type for the same feature separately. Note some of the older parameters like types and keys are deprecated. Note that if your desired last snapshot is for 1st day of a specific month, you have to fetch the data till 2nd day of the same month, as API and QGIS time range terminology does not include the end date. The current approach is to use a filter to capture the various possibilities for tags as well as OSM data types. I noticed that the result for ways/relations some times is an invalid geojson. I reported the problem and hope it will be resolved in due course. A successor to Ohsome API in the form of OhsomeDB is expected by August 2026. The queries may need some modification after that. I found experimenting with different time range could solve the problem, but might force you to choose between changing the time range or dropping the feature with issues from the study.

Styling the layers

Styling is the most time consuming task. We try to get as close as possible to OSM style. I tried to match the colors for the various layers. By classifying and looking at the number of objects of each category of feature type and also the area/activity of interest, categories with very less use or unlikely to be visible at the intended scale could be omitted. My style files are available on github, considering the interest expressed in the comments to Radiotrefoil's diary.

Specifying dimension of symbology is key for good map. Here are few steps that can help.

  • View the standard OSM website map at the zoom layer of interest for the targetted map.
  • Start with the default dimensions for most features.
  • Where different highway classes need to be distinguished by varying the width, experiment with different values to get as close as possible to OSM dimensions.

As the number of motorway, trunk features are few in my area of study, I combined them with a single style named ‘major’ and applied trunk styles using the rule based symbology expression editor. Similarly I combined tertiary, tertiary_link, service, residential types as ‘minor’ category for styling and applied the tertiary styles. OSM carto Style repo search could be useful to get the colour codes used for specific feature types. I used 0.70 for fill and 0.75 for casing as widths for major rule, 0.60,0.65 for primary, 0.40, 0.45 for secondary and 0.26, 0.30 for minor highways.

Layer positioning

Legend for the layers and symbols used in Amaravati time lapse OSM
edits

I have followed the guidance given by radiotrefoil's blog referred earlier to a large extent. The legend for my map depicting the layer positions is shown above.

Producing frames for the video

Temporal controller in the main canvas

Temporal controller is a great built in menu option to visualise and also export the frames into images. For my project, I found it tough to get a proper zoom and pan level to fill the HD resolution for the area of interest that I wanted. Users should note that the image numbering starts with 000 suffix. Please use ‘Map decorations’ menu to add title if desired. ‘Timestamp’ could be added in place of ‘Copyright label’ decoration with an expression "[%format_date(@map_start_time, 'yyyy-MM-dd')%]". You can avoid complex “ffmpeg” command line code for adding the ‘timestamp’ as overlay that Radiotrefoil's blog mentioned.

Atlas in the print layout

Atlas settings for Time lapse frame generation in
QGIS

Map item temporal range settings in Layout menu of
QGIS

To get better quality and/or desired resolution, Atlas menu in the "Layout" is the best method. For this prepare a “.csv” file with fields 'id', 'timestamp' and number of rows as needed for the period and step interval of the study. Add it as a delimited text layer. While importing make sure that ‘timestamp’ column is recognised as a date value, as this layer will be used as a coverage layer. The key to getting the frames right, is to set options in Atlas settings and Map item settings properly. Please see the picture for an example setting. The output file name is customised with ‘@atlas_featurenumber’ which corresponds to the ‘id’ in coverage layer data. It is better to start the ‘id’ number with 1 instead of 0 as the initial frame generated by Atlas would have suffix 1. A frame with suffix 0 could be generated separately in Layout view, with same extents and OSM layer instead of map activity layers enabled in the canvas. This frame serves as the context for map activity. It will be considered along with all other frames generated by Atlas when generating a video.

In the Map item properties, enable the temporal range and update Start and End dates utilising an expression involving the field_name used as pagename in the Atlas settings. In my example I have set the ‘Start’ as 'timestamp' and ‘End’ as 'timestamp' + an interval of 1 day, as I wanted the map as it existed on that day. Please see the attached screenshot.

Click the Atlas preview to see a sample frame. If the rendered map is still blank, delete the map layer and add the map layer again and update the temporal range settings.

Making the video

For short sequences, https://ezgif.com/ is a very good online website to make gif/short videos online. For long sequences, use 'ffmpeg' application to produce the video. If the video is going to be longer than 1 minute, consider adding a calm background music from copyright free sources of the same length after generating the video.

Generating webm video

ffmpeg -framerate 30 -i Output_%03d.png -c:v libvpx-vp9 output.webm

Adding background music

ffmpeg -i output.webm -i <music file of same play time as video>  -c:v copy -c:a libopus -b:a 192k -shortest 'Output with background music.webm'

Frame change rate needs to be determined based on the complexity of mapping changes in the time interval to give sufficient time for the viewer to grasp the changes. Usually 1 frame per second would be good for videos of 2-3 minutes.

Enhance it with subtitles

As the mapping area may not be familiar to most viewers, consider adding sub titles to your video separately. SubRip format is supported on most platforms including commons and youtube.

Utility of the video

Documenting OSM history for an area is difficult, given the nature of diverse contributors and diverse tools used for managing their contributions. Time lapse videos are great tool to understand the baby steps with regard to a feature in the area of interest. These also help in understanding vandalism and subsequent corrections. These also can help give a broad perspective of mapping and challenges being faced, while one as a contributor is concerned with a narrow area and specific features of interest. A state of the map article, combining other insights (example for the province of the current study) will provide a holistic understanding of OSM and thereby help direct future activities.

QGIS project, tools and other useful information

My QGIS project file, without the geojson layers is available for checking any other settings and symbology used by me. When you open the file, opt for “keep unavailable layers”, to be able to see the style information as well as other layout settings. I noticed some mistakes after I generated the video and fixed the errors with respect to highway styling and updated the revised file on the repository. If you still notice any discrepancies between the project file and this documentation, go by this documentation. For my project, 14 geojson files took up 17.6MB. About 130 frames were produced requiring 131.0MB. The final video file size was 11.5MB. Video generation on my laptop (Lenovo ThinkPad X1 Carbon 7th with Intel® Core™ i7-10710U CPU @ 1.10GHz with 6 cores and 12 threads) took about 10-14 minutes. I found Google search AI mode, ChatGPT, Perplexity to be quite useful to deal with several questions that arise while working.

The tool versions used for my project are

  • JOSM version 19439
  • ohsome API: 1.10.4
  • QGIS version 3.44.6-Solothurn
  • ffmpeg version 4.4.2-0ubuntu0.22.04.1
  • Audacity 3.7.7
  • Copyright free music: http://freemusicarchive.org

Several QGIS tutorials are available via YouTube. I found the QGIS Youtube channel by Klas Karlsson one of the best.

Thanks to all the contributors to OSM and free software eco-system for making these kinds of work worthwhile.

Enjoy making your own time lapse videos.

Location: Jayanagar 4th Block, Tilak Nagara, Bengaluru South City Corporation, Bengaluru, Bangalore South, Bengaluru Urban, Karnataka, 560011, India
Email icon Bluesky Icon Facebook Icon LinkedIn Icon Mastodon Icon Telegram Icon X Icon

Discussion

Log in to leave a comment