{"id":17879827,"url":"https://github.com/jancaha/cpp-viewshed-library","last_synced_at":"2025-10-28T17:04:57.045Z","repository":{"id":156155387,"uuid":"585839854","full_name":"JanCaha/cpp-viewshed-library","owner":"JanCaha","description":"Cpp Library to calculate Viewshed based on GDAL with comamnd line and GUI tools using Qt5.","archived":false,"fork":false,"pushed_at":"2024-05-22T11:41:20.000Z","size":1840,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-22T12:34:03.729Z","etag":null,"topics":["gdal","gis","spatial","viewshed","viewshed-analysis","visibility"],"latest_commit_sha":null,"homepage":"https://jancaha.github.io/cpp-viewshed-library/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JanCaha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-06T08:09:05.000Z","updated_at":"2024-06-04T21:43:57.238Z","dependencies_parsed_at":null,"dependency_job_id":"3d0e8f97-0e84-4b2c-9ae3-5ce3d867eb8c","html_url":"https://github.com/JanCaha/cpp-viewshed-library","commit_stats":{"total_commits":875,"total_committers":1,"mean_commits":875.0,"dds":0.0,"last_synced_commit":"58d66abaa9a747c7cf86992f7102100e178394c2"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JanCaha%2Fcpp-viewshed-library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JanCaha%2Fcpp-viewshed-library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JanCaha%2Fcpp-viewshed-library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JanCaha%2Fcpp-viewshed-library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JanCaha","download_url":"https://codeload.github.com/JanCaha/cpp-viewshed-library/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246916762,"owners_count":20854514,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gdal","gis","spatial","viewshed","viewshed-analysis","visibility"],"created_at":"2024-10-28T12:07:58.730Z","updated_at":"2025-10-28T17:04:57.038Z","avatar_url":"https://github.com/JanCaha.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Viewshed is a Cpp library to calculate Viewshed and extract LoS on Digital Surface Models\n\nLibrary using QGIS, QT API and C++20 features to calculate visibility (viewshed), inverse visibility and additional information about it. The \nlibrary is developed and tested on Linux.\n\n## Status\n\n[![Tests for Library](https://github.com/JanCaha/cpp-viewshed-library/actions/workflows/test_library.yaml/badge.svg?branch=master)](https://github.com/JanCaha/cpp-viewshed-library/actions/workflows/test_library.yaml)\n[![Prepare Deb Release, Docker Release, Release to PPA](https://github.com/JanCaha/cpp-viewshed-library/actions/workflows/create_releases.yaml/badge.svg?branch=master)](https://github.com/JanCaha/cpp-viewshed-library/actions/workflows/create_releases.yaml)\n\n## Using the library\n\nThe 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.\n\n### Binaries\n\nThere are two command line utilies: `viewshed` and `inverseviewshed`.\n\n```bash\nUsage: viewshed [options]\nViewshed.\n\nOptions:\n  -h, --help                          Displays help on commandline options.\n  --help-all                          Displays help including Qt specific\n                                      options.\n  -v, --version                       Displays version information.\n  --dem \u003c \u003e                           Raster file representing DEM for viewshed\n                                      calculation.\n  --resultsFolder \u003c \u003e                 Output folder to store the results in.\n  --observerPosition \u003c \u003e              Observer position in for XXX.XX;YY.YYY .\n  --heightObserver \u003c \u003e                Height of the observer.\n  --useCurvatureCorrections \u003ctrue\u003e    Use curvature corrections?\n  --refractionCoefficient \u003c0.142860\u003e  Refraction coefficient.\n  --earthDiameter \u003c12740000\u003e          Earth diameter.\n  --visibilityMask \u003c \u003e                Raster file representing visibility mask,\n                                      specifying areas to calculate visibility\n                                      in, for viewshed calculation.  \n```\n\n```bash\nUsage: inverseviewshed [options]\nInverseViewshed.\n\nOptions:\n  -h, --help                          Displays help on commandline options.\n  --help-all                          Displays help including Qt specific\n                                      options.\n  -v, --version                       Displays version information.\n  --dem \u003c \u003e                           Raster file representing DEM for viewshed\n                                      calculation.\n  --resultsFolder \u003c \u003e                 Output folder to store the results in.\n  --targetPosition \u003c \u003e                Target position in for XXX.XX;YY.YYY .\n  --heightObserver \u003c \u003e                Height of the observer.\n  --heightTarget \u003c0\u003e                  Height of the target.\n  --useCurvatureCorrections \u003ctrue\u003e    Use curvature corrections?\n  --refractionCoefficient \u003c0.142860\u003e  Refraction coefficient.\n  --earthDiameter \u003c12740000\u003e          Earth diameter.\n  --visibilityMask \u003c \u003e                Raster file representing visibility mask,\n                                      specifying areas to calculate visibility\n                                      in, for viewshed calculation.\n```\n\nBesides 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.\n\n![Viewshed Calculator GUI](docs/images/ViewshedCalculator.png)\n\n![LoS Extractor GUI](docs/images/LoSExtractor.png)\n\n### Docker\n\nThe easiest way to test the library is using the [docker image](https://hub.docker.com/r/cahik/viewshed). The docker contains all the necessities for running the library (QGIS with dependencies including Qt and other libraries), thus its relatively bigger size.\n\nIt is probably a reasonable idea to attach the data using [docker volumes](https://docs.docker.com/storage/volumes/) to use your data inside the docker with the provided tools.\n\nThe individual command line tools can be run as:\n\n```bash\ndocker run --rm -it -v /path/to/data:/path/to/data/in/docker cahik/viewshed:latest viewshed [parameters]\ndocker run --rm -it -v /path/to/data:/path/to/data/in/docker cahik/viewshed:latest inverseviewshed [parameters]\n```\n\nRunning the GUI tools is slightly more complicated, as display has to be configured. On Linux it looks like this:\n\n```bash\nxhost +\ndocker run --rm -it --name viewshedcalculator \\\n        -v /path/to/data:/path/to/data/in/docker \\\n        -v /tmp/.X11-unix:/tmp/.X11-unix \\\n        -e DISPLAY=unix$DISPLAY cahik/viewshed:latest viewshedcalculator\nxhost -\n\nxhost +\ndocker run --rm -it --name losextractor \\\n        -v /path/to/data:/path/to/data/in/docker \\\n        -v /tmp/.X11-unix:/tmp/.X11-unix \\\n        -e DISPLAY=unix$DISPLAY cahik/viewshed:latest losextractor\nxhost -\n```\n\n### Install on Linux (Debian based)\n\nOn distributions based on Debian, the tools can be installed from PPA.\n\n```bash\nsudo add-apt-repository ppa:jancaha/gis-tools\nsudo apt-get update\napt-get -y install simplerasters viewshed viewshed-bin \n```\n\n## Citation\n\nIf you use the library, please cite it accordingly:\n\n```bibtex\n@Software{CahaViewshed,\n  author  = {Jan Caha},\n  title   = {viewshed ({C++ Viewshed library based on GDAL and Qt})},\n  year    = {2024},\n  date    = {2024-07-11},\n  version = {4.0.3},\n  url     = {https://github.com/JanCaha/cpp-viewshed-library},\n}\n```\n\n## Setup precommits\n\n```bash\nsudo apt-get install pre-commit\npre-commit install -f\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjancaha%2Fcpp-viewshed-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjancaha%2Fcpp-viewshed-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjancaha%2Fcpp-viewshed-library/lists"}