OpenStreetMap Evolution
Posted by Chetan_Gowda on 6 August 2018 in English. Last updated on 10 August 2018.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
anddocker 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 runningapt update
- Install git
apt install git
and clone libosmiumgit 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
andutfcpp
libraries to be installed along with libosmium itself when callingmake install
, you have to use the CMake optionsINSTALL_GDALCPP
and/orINSTALL_UTFCPP
withcmake -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 librarygdal_rasterize
package by runningapt 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 toBuildingsHandler
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 anout
directory where shapefiles were stored. - Run
./rasterize.sh
to get final GIF output asanim.gif
- Now, from another terminal window copy
anim.gif
to host from containersudo 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.
Discussion
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 https://github.com/mapbox/protozero” on same directory of libosmium.
And some typo was found.
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./rasterize.sh
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.
It seems that “types.hpp” is not installed by apt install libprotozero-dev.
Then I cloned https://github.com/mapbox/protozero 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.