Contains scripts used to process the output of the GDT simulation and also scripts for setting up the simulation.
We fetch data from open street maps to add buildings to our simulation using their overpass-api.
To get a preview of which buildings you will get using the API, you can use overpass-turbo. In particular, it is useful to determine the GPS coordinates of the area you want to get buildings from. Once you have the area you want on the right-hand side window, run the query below
node
[building=yes]
({{bbox}});
way
[building=yes]
({{bbox}});
(._;>;);
out;
After that, you can go on export
and then select Data
->raw data directly from Overpass API
. On the URL generated, the GPS coordinates of the current map view will be arguments, which are easy to extract.
In order to fetch the building data and add it to a mongodb collection, you can run src/setup/buildings/fetch_building_data
.
Edit the script to configure the name of your database and also the area (in GPS coordinates) you want to get buildigns from OSM.
- Python 3 (Tested under 3.8)
- matplotlib
- jsoncpp
- Geographic lib
- mongocxx
- bsoncxx
- libmongoc
Before plotting the building data, we must first compile a C++ code which reads from mongodb and writes to a json file.
A file with the proper compilation flags is being provide (clang_flags
).
You must adjust this to point it to the path of the libraries on your computer.
Then, you can compile it with clang++
, or your C++ compiler of choice.
clang++ convert_to_cartesian.cpp @clang_flags -o convert_to_cartesian
In order to plot the data, you can run src/setup/buildings/plot_building_data
, which will first convert the coordinates to a Cartesian projection using our custom C++ code (which reads from the mongodb specified) and then plot it using matplotlib
.
You should change the script to use your central coordinates and your database.
There is a clenaup utility which is a simple Python wrapper for dropping mongo databases.
This code is licensed under GNU General Public License v2.0.