Library using GDAL, QT API and C++20 features to calculate visibility (viewshed), inverse visibility and additional information about it. The library is developed and tested on Linux.
The core of the functionality is in the library itself that can be used directly from C++, however the project defines also couple of binaries to simply use of tool.
There are two command line utilies: viewshed and inverseviewshed.
Usage: viewshed [options]
Viewshed.
Options:
-h, --help Displays help on commandline options.
--help-all Displays help including Qt specific
options.
-v, --version Displays version information.
--dem < > Raster file representing DEM for viewshed
calculation.
--resultsFolder < > Output folder to store the results in.
--observerPosition < > Observer position in for XXX.XX;YY.YYY .
--heightObserver < > Height of the observer.
--useCurvatureCorrections <true> Use curvature corrections?
--refractionCoefficient <0.142860> Refraction coefficient.
--earthDiameter <12740000> Earth diameter.
--visibilityMask < > Raster file representing visibility mask,
specifying areas to calculate visibility
in, for viewshed calculation. Usage: inverseviewshed [options]
InverseViewshed.
Options:
-h, --help Displays help on commandline options.
--help-all Displays help including Qt specific
options.
-v, --version Displays version information.
--dem < > Raster file representing DEM for viewshed
calculation.
--resultsFolder < > Output folder to store the results in.
--targetPosition < > Target position in for XXX.XX;YY.YYY .
--heightObserver < > Height of the observer.
--heightTarget <0> Height of the target.
--useCurvatureCorrections <true> Use curvature corrections?
--refractionCoefficient <0.142860> Refraction coefficient.
--earthDiameter <12740000> Earth diameter.
--visibilityMask < > Raster file representing visibility mask,
specifying areas to calculate visibility
in, for viewshed calculation.Besides that there are two binaries with GUI: viewshedcalculator and losextractor. That allow calculation of viewshed (and also inversviewshed) and its characteristics, and extraction of line-of-sight in form of CSV file.
The library is available in the custom Conda channel:
https://jancaha.github.io/conda-channel/
You can install it with:
conda install -c https://jancaha.github.io/conda-channel -c conda-forge libviewshedOr create a dedicated environment from the provided YAML file:
name: viewshed
channels:
- https://jancaha.github.io/conda-channel
- conda-forge
dependencies:
- libviewshed
- viewshed # python bindings for libraryUse this command to build environment:
conda env create -f environment.yml
conda activate viewshedIf you use the library, please cite it accordingly:
@Software{CahaViewshed,
author = {Jan Caha},
title = {viewshed ({C++ Viewshed library based on GDAL and Qt})},
year = {2026}
date = {2026-05-11}
version = {5.1.0}
url = {https://github.com/JanCaha/cpp-viewshed-library},
}sudo apt-get install pre-commit
pre-commit install -f
