Automatic building data extraction¶
Preface¶
Since sites like CadMapper are paid and only produce 3D models in a single file and don’t provide accurate placement of bounding boxes, we created a tool called OSM2OBJ which automates the whole process and produces separate 3D model files.
Features and workflow¶
OSM2OBJ is a python tool that grabs OSM data from overpass api and processes the data to separate buildings and then passes them to OSM2World to generate 3D meshes of individual buildings.
The tool takes center coordinates of a 9km x 9km bounding box as input and exports 3D models of all the buildings found in this area.
This tool, unlike CadMapper and OSM2World, provides a smart separation feature which groups all parts of the same building in a single file instead of having all buildings in a single file (CadMapper) or separating them into groups of x buildings randomly (OSM2World).
Usage¶
The tool is written in python and requires the following dependencies:
-
numpy
-
shapley
-
matplotlib
-
OSM2World (requires java runtime)
Steps of usage:
-
Clone the OSM2OBJ repository > https://github.com/Mhmd-Hisham/CitiesOS/tree/OSM2OBJ
-
Install the tool’s dependencies mentioned above
-
Open config.json to adjust the parameters of the tool > (example)
-
center_lon: the longitude of the center of the 9x9km bounding > box
-
center_lat: the latitude of the center of the 9x9km bounding box
-
osm2world_path: the path of the jar executable found inside the > installation folder of OSM2World
-
default_building_height: the default height for buildings where > no height information is found
-
osm_xml_export_path: the path to export individual building xml > files to
-
3D_models_export_path: the path to export individual building 3D > models to
-
3D_models_format: the format of the 3D models to export > (supports obj, gltf or pov)’
-
-
After configuring the tool you can simply run main.py and in a while all 3D models of buildings in the area will be exported to <3D_models_export_path>