This QGIS plugin was developed by Fraunhofer IGD on behalf of the City of Münster. The plugin combines deep-learning methods with geospatial analysis in QGIS and offers two key functionalities to identify infill potential in urban areas: gap-site detection and storey-addition analysis.
For gap-site detection, the plugin uses a U-Net-based segmentation model that detects undeveloped areas in orthophotos and separates them from built-up areas. The predicted open areas are then intersected with parcel boundaries and evaluated per parcel. The resulting vector output includes information on the size and proportion of the detected gap site as well as the servicing status. For optimal performance of this functionality, an NVIDIA graphics card is recommended. Alternatively, the model can also be run on a CPU, which leads to longer processing times.
The second functionality comprises an analysis of potential storey-addition opportunities. Existing building heights are determined from a 3D point cloud and building footprints. Each building is then compared with the heights of the surrounding area to assess whether there is potential for adding stories.
qgispy: Our build tool that packages qgis plugins including all python dependencies.proj: Fork of the rust crates proj and proj-sys, that provides rust bindings forlibproj. The goal is to switch back to the official version once all changes have been accepted upstream. Changes that were were made:- support the transformation of 3d coordinates.
- fix building in msys2 environments.
- allow to statically link libstdc++. (required to make the qgis plugin portable)
bauluecken_training: Python library for the building gap detection (and training)building-heights: Rust library with python bindings for the vertical extension potential.building_potential_plugin: QGis plugin, that provides the bauluecken_training and building-heights functionality in QGis.
QGis should be installed on the system you are building the plugin on. The procedure has been tested with QGis version 3.40.12 installed using the OSGeo4W installer.
Download and install MSYS2 from https://www.msys2.org/. MSYS2 installs multiple slightly different environments. We will be using the UCRT64 environment. Select "MSYS2 UCRT64" from the windows Start Menu to open a terminal in that environment.
To install the required packages:
# update package index and existing packages
pacman -Syu
# install required packages (ucrt)
pacman -S --noconfirm git mingw-w64-ucrt-x86_64-rustup mingw-w64-ucrt-x86_64-python mingw-w64-ucrt-x86_64-python-pipx mingw-w64-ucrt-x86_64-toolchain mingw-w64-ucrt-x86_64-cmake
# install required packages (clang)
pacman -S --noconfirm git mingw-w64-clang-x86_64-rustup mingw-w64-clang-x86_64-python mingw-w64-clang-x86_64-python-pipx mingw-w64-clang-x86_64-toolchain mingw-w64-clang-x86_64-cmake
# update rust compiler
# also ensure default toolchain is 'x86_64-pc-windows-gnu' using 'rustup show'
rustup update
Next, we need to create a python virtual environment:
# Create a Python Virtualenv.
#
# The venv is set up using the python interpreter and packages of your existing qgis installation.
# You need to pass in the path to the qgis installation on your system. Give the path to the 'qgis'
# directory inside the 'apps' directory. The path below should work for Qgis LTR installed by OSGeo4W
# in the default location.
pipx run -e --spec ./qgispy qgispy venv --venv-name .venv --qgis-installation "C:\Users\\$USER\AppData\Local\Programs\OSGeo4W\apps\qgis-ltr"
# enter venv
source .venv/Scripts/activate
# verify, that the venv is working. This should print your installed qgis version:
python -c "import qgis.utils; print(qgis.utils.Qgis.QGIS_VERSION)"
# install qgispy into venv
pip install -e ./qgispy
Now, we can build the plugin:
# Change these path to match your system.
# LIBRARY_PATH should be pointing to the bin folder inside your qgis installation where the python3.dll is located.
# LINK_STATIC_STDCPP_SEARCHPATH should point to the ucrt64/lib folder inside your msys2 installation path that contains the libstdc++.a.
export LIBRARY_PATH=/c/Users/$USER/AppData/Local/Programs/OSGeo4W/bin
export LINK_STATIC_STDCPP=1
export LINK_STATIC_STDCPP_SEARCHPATH=C:\\msys64\\ucrt64\\lib
pip cache purge
qgispy package -o "Baupotential_Plugin.zip" -p . -d Baupotential -f ./building_potential_plugin/metadata.txt -e building_potential_plugin.plugin:entrypoint -x https://download.pytorch.org/whl/cu118
An overview of all dependencies and their licenses can be seen in licenses-python.txt and licenses-rust.html.