Skip to content

jpnadas/gdt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Glasgow Digital Twin (GDT)

Contains scripts used to process the output of the GDT simulation and also scripts for setting up the simulation.

Setup

Building data

We fetch data from open street maps to add buildings to our simulation using their overpass-api.

Preview

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.

Fetch building data

Dependencies

Usage

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.

Plotting the obtained data

Dependencies

  • Python 3 (Tested under 3.8)
  • matplotlib
  • jsoncpp
  • Geographic lib
  • mongocxx
  • bsoncxx
  • libmongoc

Compilation

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

Usage

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.

Utilities

Cleanup

There is a clenaup utility which is a simple Python wrapper for dropping mongo databases.

License

This code is licensed under GNU General Public License v2.0.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published