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.
Sri Lanka (January 2015 - July 2018)
Thailand (January 2008 - July 2018)
Bangladesh (January 2015 - April 2018)
Taiwan (January 2008 - July 2018)
Democratic Republic of the Congo (January 2016 - July 2018)
Peru (January 2010 - April 2018)
Ethiopia (January 2017 - July 2018)
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 https://github.com/osmcode/libosmium.git
- 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 https://github.com/osmcode/osmium-contrib.git
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
./rasterize.sh
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.