User:Arjunaraoc/Making a time lapse video of OSM edits

From OpenStreetMap Wiki
Jump to navigation Jump to search

Published User diary

Draft: 2026-01-02

File:Amaravati timelapse OSM edits (2015-2025).webm
OpenStreetMap Edits for area around Amaravati, Andhra Pradesh during 2015-2025, For closed captions see at Commons

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. 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, landuse, buildings, highways,railways, places, amenities and also based on their basic osm type like node, way, relation. Depending on the extent of mapping activity and duration, the separated files 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 kiolmetres 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.

Use the closest relation to get the bounding box coordinates for the area of interest. 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 bbox 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, 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 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 results for ways/relation 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.

Dimensions of symbology is key for getting the best map. 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 color 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

File:Amaravati timelapse OSM edits (2015-2025) - Legend.png
Legend for the layers and symbols used in Amaravati timelapse OSM edits (2015-2025).webm file

I have followed the guidance given by radiotrefoil's blog referred earlier.

Producing frames for the video

Temporal controller in the main canvas

Temporal controller is a great built in tool 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 to add title, and timestamp 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

File:Atlas settings for Time lapse frame generation in QGIS.png
Atlas settings for Time lapse frame generation in QGIS
File:Map item temporal range settings in Layout menu of QGIS.png
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 is recognised as a date value. 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, so the initial frame could be generated separately in Layout, with same extents and OSM layer enabled in the canvas. This frame will be merged with the rest of the frames when generating a video, to provide a context for map activity.

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' end as the '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 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' 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. After experimentation, subtitles can also be burned into the video using 'ffmpeg'.

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 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 areas of interest 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 the 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. Google search AI mode, ChatGPT, Perplexity were found 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.