This tool builds a Bigraph modelling the hierarchy of administrative boundaries, streets and buildings using OpenStreetMap data.
The tool can be built using dune and opam. Tested on Ubuntu 24.04.1.
- Clone this repository and enter the project directory.
git clone https://github.com/royangkr/bigraph_of_the_world.git
cd bigraph_of_the_world/
apt update
apt install opam
opam init
- Create an opam switch while in the project directory. This also installs the project's required dependencies.
opam switch create .
- Build the project using dune.
eval $(opam env)
dune build
The binary can then be found at _build/default/bin/botw.exe
.
To run the project, use:
./botw.exe <BOUNDARY_ADMIN_LEVEL> <BOUNDARY_RELATION_ID> <BOUNDARY_NAME>
For example:
./botw.exe 8 1481934 Dover
This will build a Bigraph with Dover as its root and export the Bigraph to output/8-1481934-Dover.json
. This Bigraph will contain the hierarchy of administrative boundaries, streets and buildings contained in Dover.
The tool works for any relation on OSM with "admin_level", "id", and "name" tags. When running the tool on a new administrative boundary, querying Overpass API for osm files will take a while due to rate limiting.
To export the Bigraph to a dot file:
./botw.exe 8 1481934 Dover -write-dot