Skip to main content

CLI application for efficient and optimized reconstruction of large-scale 3D building models.

Project description

logo

Optimized reconstruction of large-scale 3D building models

License Geomatics Unit of ULiege - Development

Command-Line Interface (CLI) application for efficient and optimized reconstruction of large-scale 3D building models.

Optim3D is a powerful tool for optimized automatic reconstruction of highly detailed and large-scale 3D building models. Our tool is based on the GeoFlow software and makes use of it to perform the 3D reconstruction of buildings. The process is inspired by the 3D BAG project and optimized for large-scale projects through indexing and tiling of the input data, which significantly reduces the processing time and resources required to generate large-scale 3D building models.

Workflow of 3D Reconstruction

Documentation

If you are using Optim3D, we highly recommend that you take the time to read the documentation. The documentation is an essential resource that will help you understand the features and functionality of our software, as well as provide guidance on how to use it effectively.

Installation

You can install optim3d in your Conda environment by simply running:

conda create --name optimenv python==3.6
conda activate optimenv
conda install -c conda-forge pdal python-pdal
conda install -c conda-forge entwine
pip install optim3d

You can also build everything from source (see INSTALL.md). A Docker image is also available.

NOTE: It is important to note that in order to use our program for 3D reconstruction of buildings, GeoFlow-bundle must be installed. Please read the LICENSE file.

Usage of the CLI

Python package

After installation, you have a small program called optim3d. Use optim3d --help to see the detailed help:

Usage: optim3d [OPTIONS] COMMAND [ARGS]...

  CLI tool to manage full optimized reconstruction of large-scale 3D
  building models.

Options:
  --help  Show this message and exit.

Commands:
  index2d      QuadTree indexing and tiling of 2D building footprints.
  index3d      OcTree indexing of 3D point cloud using Entwine.
  tiler3d      Tiling of point cloud using the calculated processing areas.
  reconstruct  Optimized 3D reconstruction of buildings using GeoFlow.
  post         Post-processing generated CityJSON files.

The process consists of five steps or commands that must be executed in a specific order to achieve the desired outcome.

Step 1 : 2D building footprints indexing and tiling

Quadtree-based tiling scheme is used for spatial partitioning of building footprints. This assures that the reconstruction time per tile is more or less the same and that the tiles available for download are similar in file size. This is done using the first command index2d. Use optim3d index2d --help to see the detailed help:

Usage: optim3d index2d [OPTIONS] [FOOTPRINTS]

  QuadTree indexing and tiling of building 2D footprints.

Options:
  --output PATH                   Output directory.  [default: ./output]
  --osm <FLOAT FLOAT FLOAT FLOAT>...
                                  Download and work with building footprints
                                  from OpenStreetMap [west, north, est,
                                  south].
  --crs INTEGER                   Specify the Coordinate Reference System
                                  (EPSG).
  --max INTEGER                   Maximum number of buildings per tile.
                                  [default: 3500]
  --help                          Show this message and exit.

Step 2 : OcTree indexing of the 3D point cloud

Processing large point cloud datasets is hardware-intensive. Therefore, it is necessary to index the 3D point cloud before processing. The index structure makes it possible to stream only the parts of the data that are required, without having to download the entire dataset. In this case, the spatial indexing of the airborne point cloud is performed using an octree structure. This is done using the second command index3d. Use optim3d index3d --help to see the detailed help:

Usage: optim3d index3d [OPTIONS] POINTCLOUD

  OcTree indexing of 3D point cloud using Entwine.

Options:
  --output PATH  Output directory.  [default: ./output]
  --help         Show this message and exit.

Step 3 : Tiling of the 3D point cloud

The tiling of the indexed point cloud is based on the processing areas already calculated. This is achieved using the third command tiler3d. Use optim3d tiler3d --help to see the detailed help:

Usage: optim3d tiler3d [OPTIONS]

  Tiling of 3D point cloud using the calculated processing areas.

Options:
  --areas PATH    The calculated processing areas.  [default:
                  ./output/processing_areas.gpkg]
  --indexed PATH  Indexed 3D point cloud directory.  [default:
                  ./output/indexed_pointcloud]
  --output PATH   Output directory.  [default: ./output]
  --help          Show this message and exit.

Step 4 : 3D reconstruction of building models tile by tile

In this step, we perform the 3D reconstruction of building models. The process make use of GeoFlow to generate highly detailed 3D building models tile by tile. This is achieved using the fourth command reconstruct. Use optim3d reconstruct --help to see the detailed help:

Usage: optim3d reconstruct [OPTIONS]

  Optimized 3D reconstruction of buildings using GeoFlow.

Options:
  --pointcloud PATH  3D point cloud tiles directory.  [default:
                     ./output/pointcloud_tiles]
  --footprints PATH  2D building footprints tiles directory.  [default:
                     ./output/footprint_tiles]
  --output PATH      Output directory.  [default: ./output]
  --help             Show this message and exit.

Step 5 : Post-processing of CityJSON files

The generated CityJSON files should be post-processed to correct the City Objects IDs. This is done using the fifth command post. Use optim3d post --help to see the detailed help:

Usage: optim3d post [OPTIONS]

  Postprocess the generated CityJSON files.

Options:
  --cityjson PATH  CityJSON files directory.  [default:
                   ./output/model/cityjson]
  --help           Show this message and exit.

Docker Image

Optim3D is also available as Docker image. If you are using a Windows operating system, we recommend running the Docker container inside the Windows Subsystem for Linux 2 (WSL2) environment. Please ensure that Geoflow is installed on the WSL2 environment to ensure compatibility with the container.

These are the steps to run Optim3D as a Docker container:

  1. First pull the image using the docker pull command:
docker pull yarroudh/optim3d
  1. To run the Docker container and mount your data inside it, use the docker run command with the -v option to specify the path to the host directory and the path to the container directory where you want to mount the data folder. For example:
docker run -d -v ABSOLUTE_PATH_TO_HOST_DATA:/home/user/data yarroudh/optim3d

This command will start a Docker container in detached mode, mount the ABSOLUTE_PATH_TO_HOST_DATA directory on the host machine to the /home/user/data directory inside the container, and run the yarroudh/optim3d image. Do not change the path of the directory inside the container.

  1. Find the container ID and copy it. You can use the docker ps command to list all running containers and their IDs.
  2. Launch a command inside the container using docker exec, use the container ID or name and the command you want to run. For example:
docker exec CONTAINER_ID optim3d index2d data/FILE_NAME

This command will execute the QuadTree indexing of the 2D footprints data, which can be a Shapefile (.shp) or a GeoPackage (.gpkg).

For the reconstruct command, make sure to copy Geoflow-bundle folder to the $PATH environment variable of the container before running the reconstruction:

docker cp PATH_TO_GEOFLOW_BUNDLE CONTAINER_ID:$PATH
docker exec CONTAINER_ID optim3d reconstruct
  1. To copy the output of the command from the container to a local path, use the docker cp command with the container ID or name, the path to the file inside the container, and the path to the destination on the host machine. For example:
  • To copy the output of one command:
docker cp CONTAINER_ID:/home/user/output/footprint_tiles PATH_ON_HOST_MACHINE
  • Top copy the output of all the commands:
docker cp CONTAINER_ID:/home/user/output PATH_ON_HOST_MACHINE
  1. Finally, after executing all the commands and copying the results to your local machine, you can stop the Docker container using the docker stop command followed by the container ID or name:
docker stop CONTAINER_ID

Building from source

If you want to build the solution from source, you should follow the steps in INSTALL.md.

Results

The results of each command are saved in the output folder with the following structure:

├── output
│   ├── flowcharts
│   │   ├── *.json
│   ├── footprint_tiles
│   │   ├── *.cpg
│   │   ├── *.dbf
│   │   ├── *.prj
│   │   ├── *.shp
│   │   ├── *.shx
│   ├── indexed_pointcloud
│   │   ├── ept-data
│   │   │   ├── *.laz
│   │   ├── ept-hierarchy
│   │   │   ├── 0-0-0-0.json
│   │   ├── ept-sources
│   │   │   ├── *.json
│   │   ├── ept.json
│   │   ├── ept-build.json
│   ├── model
│   │   ├── cityjson
│   │   ├── *.city.json
│   │   ├── obj
│   │   ├── *.obj
│   │   ├── *.obj.mtl
│   ├── pointcloud_tiles
│   │   ├── *.las
│   ├── processing_areas.gpkg
│   └── quadtree.gpkg

The 3D building models can be inspected using Ninja, the official web viewer for CityJSON files.

image

Related repositories

Automatic correction of buildings ground floor elevation in 3D City Models

GeoFlow requires that the point cloud includes some ground points around the building so that it can determine the ground floor elevation. However, for aerial point clouds, buildings surrounded by others may not meet this condition which may result in inaccurate height estimation above the ground. This can be resolved using ZRect3D, a tool for automatic correction of buildings ground-floor elevation in CityJSON files using ground points from LiDAR data.

License

This software is under the BSD 3-Clause "New" or "Revised" license which is a permissive license that allows you almost unlimited freedom with the software so long as you include the BSD copyright and license notice in it. Please read the LICENSE and the COPYING files for more details.

Citation

The use of open-source software repositories has become increasingly prevalent in scientific research. If you use this repository for your research, please make sure to cite it appropriately in your work. The recommended citation format for this repository is provided in the accompanying BibTeX citation. Additionally, please make sure to comply with any licensing terms and conditions associated with the use of this repository.

@misc{yarroudh:2023:optim3d,
  author = {Yarroudh, Anass},
  title = {Optim3D: Optimized reconstruction of large-scale 3D building models},
  year = {2023},
  howpublished = {GitHub Repository},
  url = {https://github.com/Yarroudh/Optim3D}
}

Yarroudh, A. (2023). Optim3D: Optimized reconstruction of large-scale 3D building models [GitHub repository]. Retrieved from https://github.com/Yarroudh/Optim3D

About Optim3D

This software was developped by Anass Yarroudh, a Research Engineer in the Geomatics Unit of the University of Liege. For more detailed information please contact us via ayarroudh@uliege.be, we are pleased to send you the necessary information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

optim3d-0.3.0.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

optim3d-0.3.0-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file optim3d-0.3.0.tar.gz.

File metadata

  • Download URL: optim3d-0.3.0.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.10.1 urllib3/1.26.14 tqdm/4.63.0 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.13

File hashes

Hashes for optim3d-0.3.0.tar.gz
Algorithm Hash digest
SHA256 c838c3b72643e6bcf0828ead04e40174a9ae38c055697aca14c94871b5719903
MD5 2ae379a683485405aa3b492cb17aa584
BLAKE2b-256 283782ad1cc69e42dba3675115db893879105125308515305f14a20b643e3e44

See more details on using hashes here.

File details

Details for the file optim3d-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: optim3d-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 21.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.10.1 urllib3/1.26.14 tqdm/4.63.0 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.13

File hashes

Hashes for optim3d-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c7cc3a1e54107cb7b421bcc8f668dced3a2c1930e4fd58ce08173800fcc56cc8
MD5 265684cc934084cbbbaa947927a00e89
BLAKE2b-256 1f71297f994845e09831592398ee15d5fea606b3572223ce79f561ed69403911

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page