OpenStreetMap Evolution

Posted by Chetan_Gowda on 6 August 2018 in English (English)

OpenStreetMap evolved since many years. Millions of contributors are helping this project to grow everyday. Inspired by some of my friends, Karnataka and Ireland evolution projects, I wanted to vizualize different parts of the world.

Sharing simple animated GIF that I created using Mapolution on Docker on my Mac showing different countries' OSM edits over years. The snapshots are taken for every 30 days from the starting date.

srilanka-2015-01-01-2018-07-31 Sri Lanka (January 2015 - July 2018)

thailand-2008-01-01-2018-07-31 Thailand (January 2008 - July 2018)

bangladesh-2015-01-01-2018-04-30 Bangladesh (January 2015 - April 2018)

taiwan-2008-01-01-2018-07-31 Taiwan (January 2008 - July 2018)

drc-2016-01-01-2018-07-31 Democratic Republic of the Congo (January 2016 - July 2018)

peru-2010-01-01-2018-04-30 Peru (January 2010 - April 2018)

ethiopia-2017-01-01-2018-07-31 Ethiopia (January 2017 - July 2018)

bhutan-2008-01-01-2018-04-30 Bhutan (January 2008 - April 2018)

I was able to create all the above animations based on their data size which were compatible with my computer memory. Most of these countries have datadump lesser than 200MB. If you want to create GIF's of your own, you can follow below steps:

Docker setup for Mac

  • Signup for Docker hub, download it freely and install it.
  • Test whether docker running correctly in terminal. To test quickly, run docker --version and docker run hello-world.
  • Create an Ubuntu 16.04 container with docker run -it ubuntu:xenial bash

Libosmium and dependencies installation

  • Create a working directory (E.g: work) mkdir work and update Ubuntu by running apt update
  • Install git apt install git and clone libosmium git clone
  • Install libosmium dependencies. You can install all dependencies in one go apt install -q -y cmake doxygen g++ graphviz libboost-dev libbz2-dev libexpat1-dev libgdal-dev libgeos++-dev libproj-dev libsparsehash-dev make ruby ruby-json spatialite-bin zlib1g-dev
  • Install protozero by running apt install libprotozero-dev
  • Compile and build by following 5 steps: cd libosmium mkdir build cd build cmake .. make
  • If you want gdalcpp and utfcpp libraries to be installed along with libosmium itself when calling make install, you have to use the CMake options INSTALL_GDALCPP and/or INSTALL_UTFCPP with cmake -INSTALL_GDALCPP -INSTALL_UTFCPP ..
  • At last call ctest to run tests. If you dont get any errors, Congrats! your libosmium setup is complete!

Build Mapolution

  • Clone osmium-contrib git clone to working directory.
  • Change directory cd osmium-contrib
  • Install boost_filesystem and boost_program_options packages apt install ibboost-filesystem-dev libboost-program-options-dev
  • Now build by these 4 steps: mkdir build cd build cmake .. make
  • After building osmium-contrib, change directory to mapolution cd osmium-contrib/mapolution
  • Install remaining dependencies one by one apt install bc imagemagick and GDAL library gdal_rasterize package by running apt install libgdal-dev gdal-bin
  • Install gifsicle apt install gifsicle
  • Now build mapolution: mkdir build cd build cmake .. make
  • You can switch to different handler:cmake -DHANDLER=RoadsHandler .. This will filter only highways from the country extract. To get buildings, switch to BuildingsHandler

Download data

  • Download any small country data from Geofabrik.
  • Copy country data to container from host from a new terminal window tar -cv <country.osh.pbf> | docker exec -i <container_name> tar x -C /home/work/osmium-contrib/mapolution/build For example: tar -cv bhutan-internal.osh.pbf | docker exec -i practical_banach tar x -C /home/work/osmium-contrib/mapolution/build

Run Mapolution

  • After copying to build directory, run following command ./mapolution -s 2010-01-01 -e 2018-07-31 -S 30 country.osh.pbf (-s start date, -e end date, -S number of days) - This will create an out directory where shapefiles were stored.
  • Run ./ to get final GIF output as anim.gif
  • Now, from another terminal window copy anim.gif to host from container sudo docker cp <container_id>:/home/work/osmium-contrib/mapolution/build/anim.gif . For example: sudo docker cp fbb0afd5e095:/home/work/osmium-contrib/mapolution/build/anim.gif .

That's all! You've got animated OpenStreetMap evolution. Let me know if you could able to create one by these steps and post your result in comment. Happy mapping :)

Thanks to Jochen Topf and yogi_ks for helping out in resolving issues and docker setup on Mac.

Comment from arnalielsewhere on 7 August 2018 at 06:59

Thanks for sharing! Will definitely try this out!

Comment from Abhilekh Singh on 8 August 2018 at 07:23

Wow, this looks amazing. Definitely going to try this out.

Comment from Hidekichi on 9 August 2018 at 17:05

Thanks for sharing! But an error occurred when setting up libosmium. I needed clone protozero by "git clone" on same directory of libosmium.

And some typo was found.

  • apt get ibboost-filesystem-dev libboost-program-options-dev -> apt install libboost-filesystem-dev libboost-program-options-dev
  • ./ -> ../

Comment from Chetan_Gowda on 10 August 2018 at 01:54

@Hidekichi Thanks for finding typos and missing dependencies. I will make correction now.
You can directly install protozero using apt install libprotozero-dev which will install latest version. To run rasterize command just use "single dot" at the starting ./

Let me know if you could able to do that!

Comment from Hidekichi on 11 August 2018 at 15:40

@Chetan_Gowda Thanks for correction. But another error occurred.

In file included from /home/work/libosmium/include/osmium/io/detail/pbf_decoder.hpp:38:0, from /home/work/libosmium/include/osmium/io/detail/pbf_input_format.hpp:38, from /home/work/libosmium/include/osmium/io/pbf_input.hpp:45, from /home/work/libosmium/test/t/io/test_pbf.cpp:5: /home/work/libosmium/include/osmium/io/detail/protobuf_tags.hpp:36:31: fatal error: protozero/types.hpp: No such file or directory

It seems that "types.hpp" is not installed by apt install libprotozero-dev.

Then I cloned into /home/work. (ref) No error occurred. And the following process complete.

I made GIF of Shikoku islands of Japan(Janualy 2010 - July 2018.

Thank you.

Login to leave a comment