This is a project to implement a geospatial database containing the history (lineage) of OSM data objects, initiated by members of the SOSM community.
The 'OSM History DB' being updated periodically from the original OSM database and it consists of a PostgreSQL database and software tools like ope and changesetmd and other dependencies.
There are many applications for this OSM History DB and the first one is to serve data for the 'Project of the Month Switzerland' application. Another application could be to make timelapse videos with it.
The code written for this project is openly available on this repo - but it's currently for ourselves and not prepared to be installed elsewhere.
Dependencies (most surely incomplete :-O):
- ope
- changesetmd
- Python 3
- Python 2
- PostgreSQL
- shell scripts
- cron jobs
- (Debian OS)
- Create a Database
psql -U {user}
CREATE DATABASE {DB};
\c {DB}
CREATE EXTENSION postgis;
CREATE EXTENSION hstore;
- Setup ChangesetMD
apt install build-essential cmake libboost-dev libexpat1-dev zlib1g-dev libbz2-dev
or equivalentgit clone https://github.com/ToeBee/ChangesetMD
pip2 install psycopg2 lxml bz2file pyosmium
- Download changesets
python2 changesetmd.py -d {DB} -c -g -f {changesets-?.osm.bz2}
psql -U {user} -d {DB}
update osm_changeset_state set last_sequence = {SEQUENCE};
(See https://github.com/ToeBee/ChangesetMD#replication)
- Setup OPE
git clone https://github.com/lbuchli/osm-postgresql-experiments
mkdir build && cd build
cmake ..
make install
- Setup OSMHistoryDB-CH
git clone https://github.com/lbuchli/osmhistorydb-ch
cd osmhistorydb-ch/OSM_Objects
- Download osh
pyosmium-get-changes -O {switzerland-internal.osh.pbf} -f sequence.state
- Adjust paths in
insert_expanded.sh
- Initialize DB
ope -H {switzerland-internal.osh.pbf} nodes=n%I.v.d.c.t.i.T.Gp ways=w%I.v.d.c.t.i.T.N. relations=r%I.v.d.c.t.i.T.M. users=u%i.u.
psql -U {user} -d {DB} -f users.sql
psql -U {user} -d {DB} -f relations.sql
psql -U {user} -d {DB} -f ways.sql
psql -U {user} -d {DB} -f nodes.sql
psql -U {user} -d {DB} -f osmhistorydb-ch/OSM_Objects/db_setup.sql
python3 osmhistorydb-ch/OSM_Objects/osm_pg_db_clipper.py -d {DB} -b osmhistorydb-ch/OSM_Objects/borders.geojson -f {switzerland-internal.osh.pbf}
- Cronjob
- Create cache directory:
mkdir /var/cache/osmhistory-replication
*/10 * * * * bash cd {osmhistorydb-ch}/OSM_Objects/ && ./insert_expanded.sh
- Create cache directory:
Copyright (C) 2021 (tbd.)
Those programs and scripts published in this repository are available under the ISC license (see the file LICENSE.txt). Existing programs and libraries have their own license which may be different from this one.
There are many authors involved in this project and it's maintained by many. Contact: @sfkeller.